Conditions | 5 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
47 | 57 | public function __construct($value) |
|
48 | { |
||
49 | 57 | $min = 1; |
|
50 | 57 | $max = (2 ** 16) - 1; |
|
51 | |||
52 | 57 | if ($value === null) { |
|
53 | 2 | return; |
|
54 | } |
||
55 | |||
56 | 57 | if (!is_int($value)) { |
|
57 | 8 | throw new InvalidUriComponentException('URI component "port" must be an integer'); |
|
58 | } |
||
59 | |||
60 | 49 | if (!($value >= $min && $value <= $max)) { |
|
61 | 3 | throw new InvalidUriComponentException('Invalid URI component "port"'); |
|
62 | } |
||
63 | |||
64 | 49 | $this->value = $value; |
|
65 | } |
||
77 |