PortNumber   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 25
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 17 2
1
<?php
2
3
namespace ValueObjects\Web;
4
5
use ValueObjects\Exception\InvalidNativeArgumentException;
6
use ValueObjects\Number\Natural;
7
8
class PortNumber extends Natural implements PortNumberInterface
9
{
10
    /**
11
     * Returns a PortNumber object.
12
     *
13
     * @param int $value
14
     */
15 15
    public function __construct($value)
16
    {
17
        $options = array(
18
            'options' => array(
19 15
                'min_range' => 0,
20
                'max_range' => 65535
21 15
            )
22 15
        );
23
24 15
        $filteredValue = filter_var($value, FILTER_VALIDATE_INT, $options);
25
26 15
        if (false === $filteredValue) {
27 1
            throw new InvalidNativeArgumentException($value, array('int (>=0, <=65535)'));
28
        }
29
30 14
        parent::__construct($filteredValue);
31 14
    }
32
}
33