1 | <?php |
||
16 | class PrivateKeySerializer implements PrivateKeySerializerInterface |
||
17 | { |
||
18 | /** |
||
19 | * @var bool |
||
20 | */ |
||
21 | private $haveNextCompressed = false; |
||
22 | |||
23 | /** |
||
24 | * @var EcAdapter |
||
25 | */ |
||
26 | private $ecAdapter; |
||
27 | |||
28 | /** |
||
29 | * @param EcAdapter $ecAdapter |
||
30 | */ |
||
31 | 252 | public function __construct(EcAdapter $ecAdapter) |
|
35 | |||
36 | /** |
||
37 | * @param PrivateKey $privateKey |
||
38 | * @return BufferInterface |
||
39 | */ |
||
40 | 228 | private function doSerialize(PrivateKey $privateKey) |
|
44 | |||
45 | /** |
||
46 | * @param PrivateKeyInterface $privateKey |
||
47 | * @return BufferInterface |
||
48 | */ |
||
49 | 228 | public function serialize(PrivateKeyInterface $privateKey) |
|
54 | |||
55 | /** |
||
56 | * Tells the serializer the next key to be parsed should be compressed. |
||
57 | * |
||
58 | * @return $this |
||
59 | */ |
||
60 | public function setNextCompressed() |
||
65 | |||
66 | /** |
||
67 | * @param Parser $parser |
||
68 | * @return PrivateKey |
||
69 | * @throws \BitWasp\Buffertools\Exceptions\ParserOutOfRange |
||
70 | */ |
||
71 | 108 | public function fromParser(Parser $parser) |
|
81 | |||
82 | /** |
||
83 | * @param \BitWasp\Buffertools\BufferInterface|string $data |
||
84 | * @return PrivateKey |
||
85 | */ |
||
86 | 108 | public function parse($data) |
|
90 | } |
||
91 |