function HeaderUtils::combine
Combines an array of arrays into one associative array.
Each of the nested arrays should have one or two elements. The first value will be used as the keys in the associative array, and the second will be used as the values, or true if the nested array only contains one element. Array keys are lowercased.
Example:
HeaderUtils::combine([['foo', 'abc'], ['bar']]) // => ['foo' => 'abc', 'bar' => true]
4 calls to HeaderUtils::combine()
- AcceptHeader::fromString in vendor/
symfony/ http-foundation/ AcceptHeader.php - Builds an AcceptHeader instance from a string.
- AcceptHeaderItem::fromString in vendor/
symfony/ http-foundation/ AcceptHeaderItem.php - Builds an AcceptHeaderInstance instance from a string.
- Cookie::fromString in vendor/
symfony/ http-foundation/ Cookie.php - Creates cookie from raw header string.
- HeaderBag::parseCacheControl in vendor/
symfony/ http-foundation/ HeaderBag.php - Parses a Cache-Control HTTP header.
File
-
vendor/
symfony/ http-foundation/ HeaderUtils.php, line 87
Class
- HeaderUtils
- HTTP header utility functions.
Namespace
Symfony\Component\HttpFoundationCode
public static function combine(array $parts) : array {
$assoc = [];
foreach ($parts as $part) {
$name = strtolower($part[0]);
$value = $part[1] ?? true;
$assoc[$name] = $value;
}
return $assoc;
}