Added phpdoc for Cache-Control directives methods

This commit is contained in:
Tony Cosentino 2014-05-23 13:34:06 +02:00 committed by Fabien Potencier
parent eafabfaea9
commit 58b0aefa16

View File

@ -242,6 +242,14 @@ class HeaderBag implements \IteratorAggregate, \Countable
return $date;
}
/**
* Adds a custom Cache-Control directive.
*
* @param string $key The Cache-Control directive name
* @param mixed $value The Cache-Control directive value
*
* @api
*/
public function addCacheControlDirective($key, $value = true)
{
$this->cacheControl[$key] = $value;
@ -249,16 +257,41 @@ class HeaderBag implements \IteratorAggregate, \Countable
$this->set('Cache-Control', $this->getCacheControlHeader());
}
/**
* Returns true if the Cache-Control directive is defined.
*
* @param string $key The Cache-Control directive
*
* @return bool true if the directive exists, false otherwise
*
* @api
*/
public function hasCacheControlDirective($key)
{
return array_key_exists($key, $this->cacheControl);
}
/**
* Returns a Cache-Control directive value by name.
*
* @param string $key The directive name
*
* @return mixed|null The directive value if defined, null otherwise
*
* @api
*/
public function getCacheControlDirective($key)
{
return array_key_exists($key, $this->cacheControl) ? $this->cacheControl[$key] : null;
}
/**
* Removes a Cache-Control directive.
*
* @param string $key The Cache-Control directive
*
* @api
*/
public function removeCacheControlDirective($key)
{
unset($this->cacheControl[$key]);