Lines
90.90%
10 / 11
Methods
85.71%
6 / 7
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| getContext | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| getRequestedState | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| findString | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 2 | ||
| findNumber | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 3 | ||
| findBool | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 2 | ||
| findEntityId | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 2 | ||
| 12 | final readonly class ActionCall implements ExposedCommand | |
| 13 | { | |
| 14 | /** @param array<string, mixed> $data */ | |
| 15 | public function __construct( | |
| 16 | public array $data, | |
| 17 | public EventContext $context, | |
| 18 | ) {} | |
| 19 | ||
| 20 | public function getContext(): EventContext | |
| 21 | { | |
| 22 | return $this->context; | |
| 23 | } | |
| 24 | ||
| 25 | public function getRequestedState(): ?ExposedState | |
| 26 | { | |
| 27 | return null; | |
| 28 | } | |
| 29 | ||
| 30 | public function findString(string $field): ?string | |
| 31 | { | |
| 32 | $value = $this->data[$field] ?? null; | |
| 33 | ||
| 34 | return \is_string($value) ? $value : null; | |
| 35 | } | |
| 36 | ||
| 37 | public function findNumber(string $field): int|float|null | |
| 38 | { | |
| 39 | $value = $this->data[$field] ?? null; | |
| 40 | ||
| 41 | return \is_int($value) || \is_float($value) ? $value : null; | |
| 42 | } | |
| 43 | ||
| 44 | public function findBool(string $field): ?bool | |
| 45 | { | |
| 46 | $value = $this->data[$field] ?? null; | |
| 47 | ||
| 48 | return \is_bool($value) ? $value : null; | |
| 49 | } | |
| 50 | ||
| 51 | public function findEntityId(string $field): ?EntityId | |
| 52 | { | |
| 53 | $value = $this->findString($field); | |
| 54 | ||
| 55 | return $value === null ? null : EntityId::tryFromString($value); | |
| 56 | } | |
| 57 | } |