Lines
0.00%
0 / 3
Functions and Methods
0.00%
0 / 3
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| RecordedServiceCall | 0.00% | 0 / 3 | 0.00% | 0 / 3 | 20 | 0.00% | 0 / 1 | |||
| __construct | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| getServiceName | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| 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\Service\ServiceTarget; | |
| 8 | use Stewart\Contracts\State\EventContext; | |
| 9 | ||
| 10 | final readonly class RecordedServiceCall | |
| 11 | { | |
| 12 | /** @param array<string, mixed> $data */ | |
| 13 | public function __construct( | |
| 14 | public string $domain, | |
| 15 | public string $service, | |
| 16 | public array $data, | |
| 17 | public ?ServiceTarget $target, | |
| 18 | public bool $returnsResponse, | |
| 19 | public EventContext $context, | |
| 20 | ) {} | |
| 21 | ||
| 22 | public function getServiceName(): string | |
| 23 | { | |
| 24 | return $this->domain . '.' . $this->service; | |
| 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 | } |