public function getCacheControlDirective($name)
{
$value = null;
switch ($name) {
case 'public':
$value = $this->cacheDirectives['visibility'] === 'public' ? true : null;
break;
case 'private':
case 'no-cache':
preg_match('/^(' . $name . ')(?:="([^"]+)")?$/', $this->cacheDirectives['visibility'], $matches);
if (!isset($matches[1])) {
$value = null;
} else {
$value = isset($matches[2]) ? $matches[2] : true;
}
break;
case 'no-store':
case 'no-transform':
case 'must-revalidate':
case 'proxy-revalidate':
$value = $this->cacheDirectives[$name] !== '' ? true : null;
break;
case 'max-age':
case 's-maxage':
preg_match('/^(' . $name . ')=(.+)$/', $this->cacheDirectives[$name], $matches);
if (!isset($matches[1])) {
$value = null;
} else {
$value = isset($matches[2]) ? intval($matches[2]) : true;
}
break;
}
return $value;
}