Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
23 / 23 |
|
100.00% |
19 / 19 |
CRAP | |
100.00% |
1 / 1 |
FirewallRule | |
100.00% |
23 / 23 |
|
100.00% |
19 / 19 |
20 | |
100.00% |
1 / 1 |
getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getIpType | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setIpType | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getAction | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setAction | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getProtocol | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setProtocol | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getPort | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setPort | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getSubnet | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setSubnet | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
2 | |||
getSubnetSize | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setSubnetSize | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getSource | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setSource | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getNotes | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setNotes | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getModelExceptionClass | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Vultr\VultrPhp\Services\Firewall; |
6 | |
7 | use Vultr\VultrPhp\Util\Model; |
8 | |
9 | /** |
10 | * Holds firewall rule information. |
11 | */ |
12 | class FirewallRule extends Model |
13 | { |
14 | protected int $id; |
15 | protected string $ipType; |
16 | protected string $action; |
17 | protected string $protocol; |
18 | protected string $port; |
19 | protected string $subnet; |
20 | protected int $subnetSize; |
21 | protected string $source; |
22 | protected string $notes; |
23 | |
24 | public function getId() : int |
25 | { |
26 | return $this->id; |
27 | } |
28 | |
29 | public function setId(int $id) : void |
30 | { |
31 | $this->id = $id; |
32 | } |
33 | |
34 | public function getIpType() : string |
35 | { |
36 | return $this->ipType; |
37 | } |
38 | |
39 | public function setIpType(string $ip_type) : void |
40 | { |
41 | $this->ipType = $ip_type; |
42 | } |
43 | |
44 | public function getAction() : string |
45 | { |
46 | return $this->action; |
47 | } |
48 | |
49 | public function setAction(string $action) : void |
50 | { |
51 | $this->action = $action; |
52 | } |
53 | |
54 | public function getProtocol() : string |
55 | { |
56 | return $this->protocol; |
57 | } |
58 | |
59 | public function setProtocol(string $protocol) : void |
60 | { |
61 | $this->protocol = $protocol; |
62 | } |
63 | |
64 | public function getPort() : string |
65 | { |
66 | return $this->port; |
67 | } |
68 | |
69 | public function setPort(string $port) : void |
70 | { |
71 | $this->port = $port; |
72 | } |
73 | |
74 | public function getSubnet() : string |
75 | { |
76 | return $this->subnet; |
77 | } |
78 | |
79 | public function setSubnet(string $subnet) : void |
80 | { |
81 | if (strpos($subnet, '/') !== false) |
82 | { |
83 | list($ip, $bit) = explode('/', $subnet); |
84 | $subnet = $ip; |
85 | $this->setSubnetSize((int)$bit); |
86 | } |
87 | |
88 | $this->subnet = $subnet; |
89 | } |
90 | |
91 | public function getSubnetSize() : int |
92 | { |
93 | return $this->subnetSize; |
94 | } |
95 | |
96 | public function setSubnetSize(int $subnet_size) : void |
97 | { |
98 | $this->subnetSize = $subnet_size; |
99 | } |
100 | |
101 | public function getSource() : string |
102 | { |
103 | return $this->source; |
104 | } |
105 | |
106 | public function setSource(string $source) : void |
107 | { |
108 | $this->source = $source; |
109 | } |
110 | |
111 | public function getNotes() : string |
112 | { |
113 | return $this->notes; |
114 | } |
115 | |
116 | public function setNotes(string $notes) : void |
117 | { |
118 | $this->notes = $notes; |
119 | } |
120 | |
121 | public function getModelExceptionClass() : string |
122 | { |
123 | return str_replace('FirewallRuleException', 'FirewallException', parent::getModelExceptionClass()); |
124 | } |
125 | } |
126 |