You are here

protected function HeaderBag::getCacheControlHeader in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/HeaderBag.php \Symfony\Component\HttpFoundation\HeaderBag::getCacheControlHeader()
3 calls to HeaderBag::getCacheControlHeader()
HeaderBag::addCacheControlDirective in vendor/symfony/http-foundation/HeaderBag.php
Adds a custom Cache-Control directive.
HeaderBag::removeCacheControlDirective in vendor/symfony/http-foundation/HeaderBag.php
Removes a Cache-Control directive.
ResponseHeaderBag::computeCacheControlValue in vendor/symfony/http-foundation/ResponseHeaderBag.php
Returns the calculated value of the cache-control header.

File

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

Class

HeaderBag
HeaderBag is a container for HTTP headers.

Namespace

Symfony\Component\HttpFoundation

Code

protected function getCacheControlHeader() {
  $parts = array();
  ksort($this->cacheControl);
  foreach ($this->cacheControl as $key => $value) {
    if (true === $value) {
      $parts[] = $key;
    }
    else {
      if (preg_match('#[^a-zA-Z0-9._-]#', $value)) {
        $value = '"' . $value . '"';
      }
      $parts[] = "{$key}={$value}";
    }
  }
  return implode(', ', $parts);
}