| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 47 | 2 | private function sanitize(): void |
|
| 48 | { |
||
| 49 | // Well-known ports: 0 to 1023 |
||
| 50 | // Registered/user ports: 1024 to 49151 |
||
| 51 | // Dynamic/private ports: 49152 to 65535 |
||
| 52 | 2 | $port = filter_var($this['port'], FILTER_VALIDATE_INT, [ |
|
| 53 | 2 | 'options' => ['min_range' => 0, 'max_range' => 49151] |
|
| 54 | ]); |
||
| 55 | 2 | if ($port === false) { |
|
| 56 | 1 | throw new InvalidArgumentException('Invalid port: '.$this['port'].'.', 1001); |
|
| 57 | } |
||
| 58 | 1 | $this['port'] = $port; |
|
| 59 | } |
||
| 60 | } |