Completed
Push — master ( abcf31...a8a46d )
by thomas
28:08 queued 25:46
created

BitcoinTestnetRegistry::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 13
nc 2
nop 0
dl 0
loc 18
ccs 8
cts 8
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BitWasp\Bitcoin\Network\Slip132;
6
7
use BitWasp\Bitcoin\Key\Deterministic\Slip132\PrefixRegistry;
8
use BitWasp\Bitcoin\Script\ScriptType;
9
10
class BitcoinTestnetRegistry extends PrefixRegistry
11
{
12 6
    public function __construct()
13
    {
14 6
        $map = [];
15
        foreach ([
16
                     // private, public
17 6
                     [["04358394", "043587cf"], /* xpub */ [ScriptType::P2PKH]],
18
                     [["04358394", "043587cf"], /* xpub */ [ScriptType::P2SH, ScriptType::P2PKH]],
19
                     [["044a4e28", "044a5262"], /* ypub */ [ScriptType::P2SH, ScriptType::P2WKH]],
20
                     [["045f18bc", "045f1cf6"], /* zpub */ [ScriptType::P2WKH]],
21
                     [["02575048", "02575483"], /* Zpub */ [ScriptType::P2WSH, ScriptType::P2PKH]],
22
                 ] as $row) {
23 6
            list ($prefixList, $scriptType) = $row;
24 6
            $type = implode("|", $scriptType);
25 6
            $map[$type] = $prefixList;
26
        }
27
28 6
        parent::__construct($map);
29 6
    }
30
}
31