@@ 11-26 (lines=16) @@ | ||
8 | * Class IpV4 |
|
9 | * @package BaseValueObject\Scalar\Ip |
|
10 | */ |
|
11 | class IpV4 extends BaseString |
|
12 | { |
|
13 | /** |
|
14 | * @inheritdoc |
|
15 | */ |
|
16 | protected function setValue(string $value): void |
|
17 | { |
|
18 | if (!filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { |
|
19 | throw new \InvalidArgumentException( |
|
20 | sprintf('The IPv4 %s is invalid.', $value) |
|
21 | ); |
|
22 | } |
|
23 | ||
24 | $this->value = $value; |
|
25 | } |
|
26 | } |
|
27 |
@@ 11-26 (lines=16) @@ | ||
8 | * Class IpV6 |
|
9 | * @package BaseValueObject\Scalar\Ip |
|
10 | */ |
|
11 | class IpV6 extends BaseString |
|
12 | { |
|
13 | /** |
|
14 | * @inheritdoc |
|
15 | */ |
|
16 | protected function setValue(string $value): void |
|
17 | { |
|
18 | if (!filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { |
|
19 | throw new \InvalidArgumentException( |
|
20 | sprintf('The IPv6 %s is invalid.', $value) |
|
21 | ); |
|
22 | } |
|
23 | ||
24 | $this->value = $value; |
|
25 | } |
|
26 | } |
|
27 |