Completed
Pull Request — master (#89)
by thomas
20:32
created

NetworkParams::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 4
dl 0
loc 6
ccs 6
cts 6
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Blocktrail\SDK;
4
5
6
use BitWasp\Bitcoin\Network\NetworkInterface;
7
8
class NetworkParams
9
{
10
    /**
11
     * @var NetworkInterface
12
     */
13
    private $network;
14
15
    /**
16
     * @var string
17
     */
18
    private $name;
19
20
    /**
21
     * @var bool
22
     */
23
    private $testnet;
24
25
    /**
26
     * @var string
27
     */
28
    private $shortCode;
29
30
    /**
31
     * NetworkParams constructor.
32
     * @param NetworkInterface $network
33
     * @param string $name
34
     * @param string $shortCode
35
     * @param bool $testnet
36
     */
37 93
    public function __construct($shortCode, $name, $testnet, NetworkInterface $network) {
38 93
        $this->network = $network;
39 93
        $this->name = $name;
40 93
        $this->testnet = $testnet;
41 93
        $this->shortCode = $shortCode;
42 93
    }
43
44
    /**
45
     * @return string
46
     */
47 1
    public function getName() {
48 1
        return $this->name;
49
    }
50
51
    /**
52
     * @return string
53
     */
54 1
    public function getShortCode() {
55 1
        return $this->shortCode;
56
    }
57
58
    /**
59
     * @param $network
60
     * @return bool
61
     */
62 93
    public function isNetwork($network) {
63 93
        return $this->name === $network;
64
    }
65
66
    /**
67
     * @return bool
68
     */
69 1
    public function isTestnet() {
70 1
        return $this->testnet;
71
    }
72
73
    /**
74
     * @return NetworkInterface
75
     */
76 23
    public function getNetwork() {
77 23
        return $this->network;
78
    }
79
}
80