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

NetworkParams   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 72
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getName() 0 3 1
A getShortCode() 0 3 1
A isNetwork() 0 3 1
A isTestnet() 0 3 1
A getNetwork() 0 3 1
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