Lines
85.71%
6 / 7
Methods
75.00%
3 / 4
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| type | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| describe | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| toMessage | 100.00% | 4 / 4 | 100.00% | 1 / 1 | 2 | ||
| 7 | final readonly class SubscribeEvents implements SubscriptionCommand | |
| 8 | { | |
| 9 | public function __construct(public ?string $eventType = null) {} | |
| 10 | ||
| 11 | public function type(): string | |
| 12 | { | |
| 13 | return 'subscribe_events'; | |
| 14 | } | |
| 15 | ||
| 16 | public function describe(): string | |
| 17 | { | |
| 18 | return \sprintf('subscribe_events "%s"', $this->eventType ?? '*'); | |
| 19 | } | |
| 20 | ||
| 21 | public function toMessage(): array | |
| 22 | { | |
| 23 | $message = ['type' => $this->type()]; | |
| 24 | ||
| 25 | if ($this->eventType !== null) { | |
| 26 | $message['event_type'] = $this->eventType; | |
| 27 | } | |
| 28 | ||
| 29 | return $message; | |
| 30 | } | |
| 31 | } |