| Conditions | 7 |
| Paths | 5 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 7.392 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 21 | public function __construct(array $registry) |
|
| 17 | { |
||
| 18 | 21 | foreach ($registry as $scriptType => $prefixes) { |
|
| 19 | 21 | if (count($prefixes) !== 2) { |
|
| 20 | throw new \InvalidArgumentException("Expecting two BIP32 prefixes"); |
||
| 21 | } |
||
| 22 | 21 | if (strlen($prefixes[0]) !== 8 || !ctype_xdigit($prefixes[0])) { |
|
| 23 | throw new \InvalidArgumentException("Invalid private prefix"); |
||
| 24 | } |
||
| 25 | 21 | if (strlen($prefixes[1]) !== 8 || !ctype_xdigit($prefixes[1])) { |
|
| 26 | 21 | throw new \InvalidArgumentException("Invalid public .prefix"); |
|
| 27 | } |
||
| 28 | } |
||
| 29 | 21 | $this->registry = $registry; |
|
| 30 | 21 | } |
|
| 31 | |||
| 44 |