IpV6::setValue()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 10
loc 10
ccs 6
cts 6
cp 1
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace BaseValueObject\Scalar\Ip;
4
5
use BaseValueObject\Scalar\BaseString;
6
7
/**
8
 * Class IpV6
9
 * @package BaseValueObject\Scalar\Ip
10
 */
11 View Code Duplication
class IpV6 extends BaseString
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    /**
14
     * @inheritdoc
15
     */
16 6
    protected function setValue(string $value): void
17
    {
18 6
        if (!filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
19 3
            throw new \InvalidArgumentException(
20 3
                sprintf('The IPv6 %s is invalid.', $value)
21
            );
22
        }
23
24 3
        $this->value = $value;
25 3
    }
26
}
27