minor #10974 [HttpFoundation] Added PHPDoc for Cache-Control directives methods (tony-co)
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #10974).
Discussion
----------
[HttpFoundation] Added PHPDoc for Cache-Control directives methods
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
58b0aef
Added phpdoc for Cache-Control directives methods
This commit is contained in:
commit
636f0d5d99
@ -242,6 +242,14 @@ class HeaderBag implements \IteratorAggregate, \Countable
|
|||||||
return $date;
|
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)
|
public function addCacheControlDirective($key, $value = true)
|
||||||
{
|
{
|
||||||
$this->cacheControl[$key] = $value;
|
$this->cacheControl[$key] = $value;
|
||||||
@ -249,16 +257,41 @@ class HeaderBag implements \IteratorAggregate, \Countable
|
|||||||
$this->set('Cache-Control', $this->getCacheControlHeader());
|
$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)
|
public function hasCacheControlDirective($key)
|
||||||
{
|
{
|
||||||
return array_key_exists($key, $this->cacheControl);
|
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)
|
public function getCacheControlDirective($key)
|
||||||
{
|
{
|
||||||
return array_key_exists($key, $this->cacheControl) ? $this->cacheControl[$key] : null;
|
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)
|
public function removeCacheControlDirective($key)
|
||||||
{
|
{
|
||||||
unset($this->cacheControl[$key]);
|
unset($this->cacheControl[$key]);
|
||||||
|
Reference in New Issue
Block a user