Ip::getAddress()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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