| Conditions | 4 |
| Paths | 9 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4.1755 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 17 | protected function readBase58($strAddress, NetworkInterface $network) { |
|
| 20 | try { |
||
| 21 | 17 | $data = Base58::decodeCheck($strAddress); |
|
| 22 | 17 | $prefixByte = $data->slice(0, 1)->getHex(); |
|
| 23 | |||
| 24 | 17 | if ($prefixByte === $network->getP2shByte()) { |
|
| 25 | 17 | return new ScriptHashAddress($data->slice(1)); |
|
| 26 | } else if ($prefixByte === $network->getAddressByte()) { |
||
| 27 | return new PayToPubKeyHashAddress($data->slice(1)); |
||
| 28 | } |
||
| 29 | 2 | } catch (\Exception $e) { |
|
|
|
|||
| 30 | } |
||
| 31 | 2 | return null; |
|
| 32 | } |
||
| 33 | |||
| 47 |