Total Complexity | 4 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
10 | class Ipv6 implements IpInterface |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | private $ip; |
||
17 | |||
18 | /** |
||
19 | * Ipv4 constructor. |
||
20 | 11 | * @param string $ip |
|
21 | */ |
||
22 | 11 | public function __construct(string $ip) |
|
23 | 3 | { |
|
24 | if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { |
||
25 | throw new \InvalidArgumentException('IPv6: a valid IPv6 address is required'); |
||
26 | 8 | } |
|
27 | 8 | ||
28 | $this->ip = $ip; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | 6 | * @return string |
|
33 | */ |
||
34 | 6 | public function getHost(): string |
|
35 | { |
||
36 | return $this->ip; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | 6 | * @return BufferInterface |
|
41 | */ |
||
42 | 6 | public function getBuffer(): BufferInterface |
|
45 | } |
||
46 | } |
||
47 |