Code Duplication    Length = 16-16 lines in 2 locations

src/BaseValueObject/Scalar/Ip/IpV4.php 1 location

@@ 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

src/BaseValueObject/Scalar/Ip/IpV6.php 1 location

@@ 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