| Total Complexity | 4 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class GetDataSerializer |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var \BitWasp\Buffertools\Types\Vector |
||
| 19 | */ |
||
| 20 | 96 | private $vectorInt; |
|
| 21 | |||
| 22 | 96 | /** |
|
| 23 | 96 | * @param InventorySerializer $inv |
|
| 24 | */ |
||
| 25 | public function __construct(InventorySerializer $inv) |
||
| 28 | 3 | } |
|
| 29 | |||
| 30 | 3 | /** |
|
| 31 | 3 | * @param Parser $parser |
|
| 32 | 3 | * @return GetData |
|
| 33 | 3 | */ |
|
| 34 | 3 | public function fromParser(Parser $parser): GetData |
|
| 35 | { |
||
| 36 | $addrs = $this->vectorInt->read($parser); |
||
| 37 | return new GetData($addrs); |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | 3 | * @param BufferInterface $data |
|
| 42 | * @return GetData |
||
| 43 | 3 | */ |
|
| 44 | 3 | public function parse(BufferInterface $data): GetData |
|
| 45 | { |
||
| 46 | return $this->fromParser(new Parser($data)); |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @param GetData $getData |
||
| 51 | 3 | * @return BufferInterface |
|
| 52 | */ |
||
| 53 | 3 | public function serialize(GetData $getData): BufferInterface |
|
| 56 | } |
||
| 57 | } |
||
| 58 |