Base58::decode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace mattvb91\TronTrx\Support;
4
5
/**
6
 * @codeCoverageIgnore
7
 */
8
class Base58
9
{
10
    const AVAILABLE_CHARS = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
11
12
    public static function encode($num, $length = 58): string
13
    {
14
        return Crypto::dec2base($num, $length, self::AVAILABLE_CHARS);
0 ignored issues
show
Bug Best Practice introduced by
The expression return mattvb91\TronTrx\... self::AVAILABLE_CHARS) could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
15
    }
16
17
    public static function decode(string $addr, int $length = 58): string
18
    {
19
        return Crypto::base2dec($addr, $length, self::AVAILABLE_CHARS);
0 ignored issues
show
Bug Best Practice introduced by
The expression return mattvb91\TronTrx\... self::AVAILABLE_CHARS) could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
20
    }
21
}
22