function normalize_header in Auth0 Single Sign On 8.2
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 162
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;
}