| Conditions | 5 |
| Paths | 4 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 12 | function get_request_header(string $name) |
||
| 13 | { |
||
| 14 | $name = \strtoupper($name); |
||
| 15 | |||
| 16 | // IIS/Some Apache versions and configurations |
||
| 17 | if (isset($_SERVER['HTTP_' . $name])) { |
||
| 18 | return \trim($_SERVER['HTTP_' . $name]); |
||
| 19 | } |
||
| 20 | |||
| 21 | // Various other SAPIs |
||
| 22 | if (\function_exists('apache_request_headers')) { |
||
| 23 | foreach (\apache_request_headers() as $headerName => $value) { |
||
| 24 | if (\strtoupper($headerName) === $name) { |
||
| 25 | return \trim($value); |
||
| 26 | } |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | return null; |
||
| 31 | } |
||
| 32 |