| @@ 111-122 (lines=12) @@ | ||
| 108 | * @param array $headers |
|
| 109 | * @return string |
|
| 110 | */ |
|
| 111 | protected function headerEncoding(array $headers) |
|
| 112 | { |
|
| 113 | foreach ($headers as $header) { |
|
| 114 | $split = array_map('trim', mb_split(';', $header)); |
|
| 115 | foreach ($split as $string) { |
|
| 116 | if (mb_stripos($string, 'charset=') === 0) { |
|
| 117 | return mb_split('=', $string, 2)[1]; |
|
| 118 | } |
|
| 119 | } |
|
| 120 | } |
|
| 121 | return self::ENCODING; |
|
| 122 | } |
|
| 123 | ||
| 124 | /** |
|
| 125 | * Cache-Control max-age HTTP header |
|
| @@ 130-141 (lines=12) @@ | ||
| 127 | * @param array $headers |
|
| 128 | * @return int |
|
| 129 | */ |
|
| 130 | protected function headerMaxAge(array $headers) |
|
| 131 | { |
|
| 132 | foreach ($headers as $header) { |
|
| 133 | $split = array_map('trim', mb_split(',', $header)); |
|
| 134 | foreach ($split as $string) { |
|
| 135 | if (mb_stripos($string, 'max-age=') === 0) { |
|
| 136 | return intval(mb_split('=', $string, 2)[1]); |
|
| 137 | } |
|
| 138 | } |
|
| 139 | } |
|
| 140 | return 0; |
|
| 141 | } |
|
| 142 | ||
| 143 | /** |
|
| 144 | * Parser client |
|