1 | <?php |
||
12 | class EcSerializer |
||
13 | { |
||
14 | const PATH_PHPECC = 'BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\\'; |
||
15 | const PATH_SECP256K1 = 'BitWasp\Bitcoin\Crypto\EcAdapter\Impl\Secp256k1\\'; |
||
16 | |||
17 | /** |
||
18 | * @var string[] |
||
19 | */ |
||
20 | private static $serializerInterface = [ |
||
21 | PrivateKeySerializerInterface::class, |
||
22 | PublicKeySerializerInterface::class, |
||
23 | CompactSignatureSerializerInterface::class, |
||
24 | DerSignatureSerializerInterface::class, |
||
25 | ]; |
||
26 | |||
27 | /** |
||
28 | * @var string[] |
||
29 | */ |
||
30 | private static $serializerImpl = [ |
||
31 | 'Serializer\Key\PrivateKeySerializer', |
||
32 | 'Serializer\Key\PublicKeySerializer', |
||
33 | 'Serializer\Signature\CompactSignatureSerializer', |
||
34 | 'Serializer\Signature\DerSignatureSerializer' |
||
35 | ]; |
||
36 | |||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | private static $map = []; |
||
41 | |||
42 | /** |
||
43 | * @var bool |
||
44 | */ |
||
45 | private static $useCache = true; |
||
46 | |||
47 | /** |
||
48 | * @var array |
||
49 | */ |
||
50 | private static $cache = []; |
||
51 | |||
52 | /** |
||
53 | * @param $interface |
||
54 | * @return mixed |
||
55 | 549 | */ |
|
56 | public static function getImplRelPath($interface) |
||
78 | |||
79 | /** |
||
80 | * @return array |
||
81 | 549 | */ |
|
82 | public static function getImplPaths() |
||
89 | |||
90 | /** |
||
91 | * @param EcAdapterInterface $adapter |
||
92 | * @return mixed |
||
93 | 549 | */ |
|
94 | public static function getAdapterImplPath(EcAdapterInterface $adapter) |
||
104 | |||
105 | /** |
||
106 | * @param $interface |
||
107 | * @param bool|true $useCache |
||
108 | * @param EcAdapterInterface $adapter |
||
109 | * @return mixed |
||
110 | 549 | */ |
|
111 | public static function getSerializer($interface, $useCache = true, EcAdapterInterface $adapter = null) |
||
128 | |||
129 | /** |
||
130 | * Disables caching of serializers |
||
131 | */ |
||
132 | public static function disableCache() |
||
136 | } |
||
137 |