Total Complexity | 5 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
10 | class IPAddress implements Type |
||
11 | { |
||
12 | /** |
||
13 | * @var string $ip |
||
14 | */ |
||
15 | private $ip; |
||
16 | |||
17 | /** |
||
18 | * Create an ip address object if data is valid. |
||
19 | * @param string $ip |
||
20 | * @param Validator $validator |
||
21 | * @throws \InvalidArgumentException |
||
22 | */ |
||
23 | public function __construct(string $ip, Validator $validator = null) |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Get string representation of the ip address object. |
||
42 | * @return string |
||
43 | */ |
||
44 | public function __toString(): string |
||
45 | { |
||
46 | return $this->ip; |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * Get real value of the ip address object. |
||
51 | * @return string |
||
52 | */ |
||
53 | public function getValue() : string |
||
56 | } |
||
57 | } |