You are here

protected function HeaderBag::parseCacheControl in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/HeaderBag.php \Symfony\Component\HttpFoundation\HeaderBag::parseCacheControl()

Parses a Cache-Control HTTP header.

Parameters

string $header The value of the Cache-Control HTTP header:

Return value

array An array representing the attribute values

2 calls to HeaderBag::parseCacheControl()
HeaderBag::set in vendor/symfony/http-foundation/HeaderBag.php
Sets a header by name.
ResponseHeaderBag::set in vendor/symfony/http-foundation/ResponseHeaderBag.php
Sets a header by name.

File

vendor/symfony/http-foundation/HeaderBag.php, line 314

Class

HeaderBag
HeaderBag is a container for HTTP headers.

Namespace

Symfony\Component\HttpFoundation

Code

protected function parseCacheControl($header) {
  $cacheControl = array();
  preg_match_all('#([a-zA-Z][a-zA-Z_-]*)\\s*(?:=(?:"([^"]*)"|([^ \\t",;]*)))?#', $header, $matches, PREG_SET_ORDER);
  foreach ($matches as $match) {
    $cacheControl[strtolower($match[1])] = isset($match[3]) ? $match[3] : (isset($match[2]) ? $match[2] : true);
  }
  return $cacheControl;
}