sfWebResponse::addCacheControlHttpHeader PHP Method

addCacheControlHttpHeader() public method

Adds an control cache http header.
public addCacheControlHttpHeader ( string $name, string $value = null )
$name string HTTP header
$value string Value for the http header
    public function addCacheControlHttpHeader($name, $value = null)
    {
        $cacheControl = $this->getHttpHeader('Cache-Control');
        $currentHeaders = array();
        if ($cacheControl) {
            foreach (preg_split('/\\s*,\\s*/', $cacheControl) as $tmp) {
                $tmp = explode('=', $tmp);
                $currentHeaders[$tmp[0]] = isset($tmp[1]) ? $tmp[1] : null;
            }
        }
        $currentHeaders[str_replace('_', '-', strtolower($name))] = $value;
        $headers = array();
        foreach ($currentHeaders as $key => $value) {
            $headers[] = $key . (null !== $value ? '=' . $value : '');
        }
        $this->setHttpHeader('Cache-Control', implode(', ', $headers));
    }