@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | * @param string $key |
| 33 | 33 | * @return bool |
| 34 | 34 | */ |
| 35 | - public static function hasHeader(string $key): bool |
|
| 36 | - { |
|
| 37 | - list($keyWithHyphens, $keyWithUnderscores) = self::normalizeHeaderKey($key); |
|
| 35 | + public static function hasHeader(string $key): bool |
|
| 36 | + { |
|
| 37 | + list($keyWithHyphens, $keyWithUnderscores) = self::normalizeHeaderKey($key); |
|
| 38 | 38 | |
| 39 | - return isset(self::$__headers[$keyWithHyphens]) || isset(self::$__headers[$keyWithUnderscores]); |
|
| 40 | - } |
|
| 39 | + return isset(self::$__headers[$keyWithHyphens]) || isset(self::$__headers[$keyWithUnderscores]); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * Gets the request header by given key |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public static function getHeader(string $key): ?string |
| 48 | 48 | { |
| 49 | - list($keyWithHyphens, $keyWithUnderscores) = self::normalizeHeaderKey($key); |
|
| 49 | + list($keyWithHyphens, $keyWithUnderscores) = self::normalizeHeaderKey($key); |
|
| 50 | 50 | |
| 51 | - if (array_key_exists($keyWithHyphens, self::$__headers)) { |
|
| 52 | - return self::$__headers[$keyWithHyphens]; |
|
| 53 | - } elseif (array_key_exists($keyWithUnderscores, self::$__headers)) { |
|
| 54 | - return self::$__headers[$keyWithUnderscores]; |
|
| 55 | - } |
|
| 56 | - return null; |
|
| 51 | + if (array_key_exists($keyWithHyphens, self::$__headers)) { |
|
| 52 | + return self::$__headers[$keyWithHyphens]; |
|
| 53 | + } elseif (array_key_exists($keyWithUnderscores, self::$__headers)) { |
|
| 54 | + return self::$__headers[$keyWithUnderscores]; |
|
| 55 | + } |
|
| 56 | + return null; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -86,14 +86,14 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * @param string $key |
|
| 91 | - * @return array |
|
| 92 | - */ |
|
| 93 | - private static function normalizeHeaderKey(string $key): array |
|
| 94 | - { |
|
| 95 | - $keyWithHyphens = str_replace('_', '-', strtolower($key)); |
|
| 96 | - $keyWithUnderscores = str_replace('-', '_', $key); |
|
| 97 | - return [$keyWithHyphens, $keyWithUnderscores]; |
|
| 98 | - } |
|
| 89 | + /** |
|
| 90 | + * @param string $key |
|
| 91 | + * @return array |
|
| 92 | + */ |
|
| 93 | + private static function normalizeHeaderKey(string $key): array |
|
| 94 | + { |
|
| 95 | + $keyWithHyphens = str_replace('_', '-', strtolower($key)); |
|
| 96 | + $keyWithUnderscores = str_replace('-', '_', $key); |
|
| 97 | + return [$keyWithHyphens, $keyWithUnderscores]; |
|
| 98 | + } |
|
| 99 | 99 | } |
| 100 | 100 | \ No newline at end of file |