1 | <?php |
||
12 | class Base58 |
||
13 | { |
||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | private static $base58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; |
||
18 | |||
19 | /** |
||
20 | * Encode a given hex string in base58 |
||
21 | * |
||
22 | * @param BufferInterface $buffer |
||
23 | * @return string |
||
24 | * @throws \Exception |
||
25 | 330 | */ |
|
26 | public static function encode(BufferInterface $buffer) |
||
54 | |||
55 | /** |
||
56 | * Decode a base58 string |
||
57 | * @param string $base58 |
||
58 | * @return Buffer |
||
59 | * @throws Base58InvalidCharacter |
||
60 | 390 | */ |
|
61 | public static function decode($base58) |
||
87 | |||
88 | /** |
||
89 | 366 | * Calculate a checksum for the given data |
|
90 | * |
||
91 | 366 | * @param BufferInterface $data |
|
92 | * @return BufferInterface |
||
93 | */ |
||
94 | public static function checksum(BufferInterface $data) |
||
98 | |||
99 | /** |
||
100 | * Decode a base58 checksum string and validate checksum |
||
101 | 312 | * |
|
102 | * @param string $base58 |
||
103 | 312 | * @return BufferInterface |
|
104 | 312 | * @throws Base58ChecksumFailure |
|
105 | 312 | */ |
|
106 | public static function decodeCheck($base58) |
||
118 | |||
119 | /** |
||
120 | * Encode the given data in base58, with a checksum to check integrity. |
||
121 | 252 | * |
|
122 | * @param BufferInterface $data |
||
123 | 252 | * @return string |
|
124 | * @throws \Exception |
||
125 | */ |
||
126 | public static function encodeCheck(BufferInterface $data) |
||
130 | } |
||
131 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.