Ip   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 11
c 1
b 0
f 0
dl 0
loc 37
ccs 11
cts 11
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A getAddress() 0 3 1
A getAffectedBits() 0 3 1
A setData() 0 6 1
1
<?php
2
3
namespace kalanis\kw_bans;
4
5
6
/**
7
 * Class Ip
8
 * @package kalanis\kw_bans\Bans
9
 * Basic representation of IP address
10
 * @link https://www.ibm.com/docs/en/ts3500-tape-library?topic=formats-subnet-masks-ipv4-prefixes-ipv6
11
 */
12
class Ip
13
{
14
    protected int $type = Interfaces\IIpTypes::TYPE_NONE;
15
    /** @var array<int, string> */
16
    protected array $address = [];
17
    protected int $affectedBits = 0;
18
19
    /**
20
     * @param int $type
21
     * @param array<int, string> $address
22
     * @param int $affectedBits
23
     * @return $this
24
     */
25 26
    public function setData(int $type, array $address, int $affectedBits = 0): self
26
    {
27 26
        $this->type = $type;
28 26
        $this->address = $address;
29 26
        $this->affectedBits = $affectedBits;
30 26
        return $this;
31
    }
32
33 1
    public function getType(): int
34
    {
35 1
        return $this->type;
36
    }
37
38
    /**
39
     * @return array<int, string>
40
     */
41 23
    public function getAddress(): array
42
    {
43 23
        return $this->address;
44
    }
45
46 23
    public function getAffectedBits(): int
47
    {
48 23
        return $this->affectedBits;
49
    }
50
}
51