Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
10 | private static function marshalProtocolVersion(array $server) : string |
||
|
|||
11 | { |
||
12 | if (! isset($server['SERVER_PROTOCOL'])) { |
||
13 | return '1.1'; |
||
14 | } |
||
15 | if (! preg_match('#^(HTTP/)?(?P<version>[1-9]\d*(?:\.\d)?)$#', $server['SERVER_PROTOCOL'], $matches)) { |
||
16 | throw new \UnexpectedValueException( |
||
17 | sprintf( |
||
18 | 'Unrecognized protocol version (%s)', |
||
19 | $server['SERVER_PROTOCOL'] |
||
20 | ) |
||
21 | ); |
||
22 | } |
||
23 | return $matches['version']; |
||
24 | } |
||
25 | |||
50 |
Overwriting private methods is generally fine as long as you also use private visibility. It might still be preferable for understandability to use a different method name.