Total Complexity | 5 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
8 | final class EchoRequest implements Message |
||
9 | { |
||
10 | public const MESSAGE_TYPE_ID = 58; |
||
11 | public const WIRE_SIZE = 64; |
||
12 | |||
13 | private $payload; |
||
14 | |||
15 | /** |
||
16 | * @param string $payload |
||
17 | * @throws InvalidValueException |
||
18 | */ |
||
19 | 7 | public function __construct(string $payload) |
|
20 | { |
||
21 | 7 | if (\strlen($payload) !== 64) { |
|
22 | 2 | throw new InvalidValueException("Echo request payload should be exactly 64 bytes"); |
|
23 | } |
||
24 | |||
25 | 5 | $this->payload = $payload; |
|
26 | } |
||
27 | |||
28 | 3 | public function getPayload(): string |
|
31 | } |
||
32 | |||
33 | 1 | public function getTypeId(): int |
|
34 | { |
||
35 | 1 | return self::MESSAGE_TYPE_ID; |
|
36 | } |
||
37 | |||
38 | 1 | public function getWireSize(): int |
|
41 | } |
||
42 | } |
||
43 |