Base58   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A decode() 0 3 1
A encode() 0 3 1
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