Total Complexity | 4 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
13 | class PongSerializer |
||
14 | 9 | { |
|
15 | /** |
||
16 | 9 | * @var \BitWasp\Buffertools\Types\Uint64 |
|
17 | 9 | */ |
|
18 | 9 | private $uint64; |
|
19 | |||
20 | public function __construct() |
||
21 | { |
||
22 | $this->uint64 = Types::uint64(); |
||
23 | } |
||
24 | |||
25 | 9 | /** |
|
26 | * @param Pong $pong |
||
27 | 9 | * @return BufferInterface |
|
28 | 9 | */ |
|
29 | 6 | public function serialize(Pong $pong): BufferInterface |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param Parser $parser |
||
36 | 3 | * @return Pong |
|
37 | */ |
||
38 | 3 | public function fromParser(Parser $parser): Pong |
|
39 | 3 | { |
|
40 | return new Pong((int) $this->uint64->read($parser)); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @param BufferInterface $data |
||
45 | * @return Pong |
||
46 | 3 | */ |
|
47 | public function parse(BufferInterface $data): Pong |
||
50 | } |
||
51 | } |
||
52 |