Lines
66.66%
2 / 3
Functions and Methods
66.66%
2 / 3
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| RecordedActionCall | 66.66% | 2 / 3 | 66.66% | 2 / 3 | 4.59 | 0.00% | 0 / 1 | |||
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| getActionName | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| listTargetedEntityIds | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 6 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Testing\HaContext; | |
| 6 | ||
| 7 | use Stewart\Contracts\Action\ActionTarget; | |
| 8 | use Stewart\Contracts\State\EventContext; | |
| 9 | ||
| 10 | final readonly class RecordedActionCall | |
| 11 | { | |
| 12 | /** @param array<string, mixed> $data */ | |
| 13 | public function __construct( | |
| 14 | public string $domain, | |
| 15 | public string $action, | |
| 16 | public array $data, | |
| 17 | public ?ActionTarget $target, | |
| 18 | public bool $returnsResponse, | |
| 19 | public EventContext $context, | |
| 20 | ) {} | |
| 21 | ||
| 22 | public function getActionName(): string | |
| 23 | { | |
| 24 | return $this->domain . '.' . $this->action; | |
| 25 | } | |
| 26 | ||
| 27 | /** @return list<string> */ | |
| 28 | public function listTargetedEntityIds(): array | |
| 29 | { | |
| 30 | return $this->target === null ? [] : array_map(strval(...), $this->target->entityIds); | |
| 31 | } | |
| 32 | } |