Completed
Pull Request — master (#49)
by thomas
26:36
created

AbstractBitcoinCash::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 2
dl 0
loc 13
ccs 11
cts 11
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Blocktrail\SDK\Network;
4
5
use BitWasp\Bitcoin\Network\Network;
6
use BitWasp\Bitcoin\Network\NetworkInterface;
7
8
abstract class AbstractBitcoinCash extends Network implements BitcoinCashNetworkInterface
9
{
10
    /**
11
     * @var string
12
     */
13
    private $cashAddressPrefix;
14
15
    /**
16
     * BitcoinCash constructor.
17
     * @param NetworkInterface $base
18
     * @param string $cashAddressPrefix
19
     * @throws \Exception
20
     */
21 13
    public function __construct(NetworkInterface $base, $cashAddressPrefix) {
22 13
        parent::__construct(
23 13
            $base->getAddressByte(),
24 13
            $base->getP2shByte(),
25 13
            $base->getPrivByte(),
26 13
            $base->isTestnet()
27
        );
28
29 13
        $this->setHDPrivByte($base->getHDPrivByte());
30 13
        $this->setHDPubByte($base->getHDPubByte());
31 13
        $this->setNetMagicBytes($base->getNetMagicBytes());
32 13
        $this->cashAddressPrefix = $cashAddressPrefix;
33 13
    }
34
35
    /**
36
     * @return string
37
     */
38 9
    public function getCashAddressPrefix() {
39 9
        return $this->cashAddressPrefix;
40
    }
41
}
42