Completed
Pull Request — master (#118)
by thomas
07:20
created

AbstractBitcoinCash::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 13
ccs 0
cts 12
cp 0
crap 2
rs 9.8333
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
    public function __construct(NetworkInterface $base, $cashAddressPrefix) {
22
        parent::__construct(
23
            $base->getAddressByte(),
24
            $base->getP2shByte(),
25
            $base->getPrivByte(),
26
            $base->isTestnet()
27
        );
28
29
        $this->setHDPrivByte($base->getHDPrivByte());
30
        $this->setHDPubByte($base->getHDPubByte());
31
        $this->setNetMagicBytes($base->getNetMagicBytes());
32
        $this->cashAddressPrefix = $cashAddressPrefix;
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function getCashAddressPrefix() {
39
        return $this->cashAddressPrefix;
40
    }
41
}
42