function normalize_header in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/guzzlehttp/psr7/src/functions.php \GuzzleHttp\Psr7\normalize_header()
Converts an array of header values that may contain comma separated headers into an array of headers with no comma separated values.
Parameters
string|array $header Header to normalize.:
Return value
array Returns the normalized header field values.
1 call to normalize_header()
- parse_header in vendor/
guzzlehttp/ psr7/ src/ functions.php - Parse an array of header values containing ";" separated data into an array of associative arrays representing the header key value pair data of the header. When a parameter does not contain a value, but just contains a key, this function…
File
- vendor/
guzzlehttp/ psr7/ src/ functions.php, line 159
Namespace
GuzzleHttp\Psr7Code
function normalize_header($header) {
if (!is_array($header)) {
return array_map('trim', explode(',', $header));
}
$result = [];
foreach ($header as $value) {
foreach ((array) $value as $v) {
if (strpos($v, ',') === false) {
$result[] = $v;
continue;
}
foreach (preg_split('/,(?=([^"]*"[^"]*")*[^"]*$)/', $v) as $vv) {
$result[] = trim($vv);
}
}
}
return $result;
}