| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function getVersion(array $server): string |
||
| 12 | { |
||
| 13 | if (!isset($server['SERVER_PROTOCOL'])) { |
||
| 14 | return '1.1'; |
||
| 15 | } |
||
| 16 | |||
| 17 | if (!preg_match('#^(HTTP/)?(?P<version>[1-9]\d*(?:\.\d)?)$#', $server['SERVER_PROTOCOL'], $matches)) { |
||
| 18 | throw new UnownedProtocolVersion( |
||
| 19 | (string) $server['SERVER_PROTOCOL'] |
||
| 20 | ); |
||
| 21 | } |
||
| 22 | |||
| 23 | return $matches['version']; |
||
| 24 | } |
||
| 25 | } |