PHP Class Symfony\Component\HttpFoundation\ResponseHeaderBag

Author: Fabien Potencier ([email protected])
Inheritance: extends HeaderBag
Show file Open project: symfony/symfony Class Usage Examples

Protected Properties

Property Type Description
$computedCacheControl array
$cookies array
$headerNames array

Public Methods

Method Description
__construct ( array $headers = [] ) Constructor.
all ( )
allPreserveCase ( ) : array Returns the headers, with original capitalizations.
allPreserveCaseWithoutCookies ( )
clearCookie ( string $name, string $path = '/', string $domain = null, boolean $secure = false, boolean $httpOnly = true ) Clears a cookie in the browser.
getCacheControlDirective ( $key )
getCookies ( string $format = self::COOKIES_FLAT ) : array Returns an array with all cookies.
hasCacheControlDirective ( $key )
makeDisposition ( string $disposition, string $filename, string $filenameFallback = '' ) : string Generates a HTTP Content-Disposition field-value.
remove ( $key )
removeCookie ( string $name, string $path = '/', string $domain = null ) Removes a cookie from the array, but does not unset it in the browser.
replace ( array $headers = [] )
set ( $key, $values, $replace = true )
setCookie ( Cookie $cookie ) Sets a cookie.

Protected Methods

Method Description
computeCacheControlValue ( ) : string Returns the calculated value of the cache-control header.

Method Details

__construct() public method

Constructor.
public __construct ( array $headers = [] )
$headers array An array of HTTP headers

all() public method

public all ( )

allPreserveCase() public method

Returns the headers, with original capitalizations.
public allPreserveCase ( ) : array
return array An array of headers

allPreserveCaseWithoutCookies() public method

clearCookie() public method

Clears a cookie in the browser.
public clearCookie ( string $name, string $path = '/', string $domain = null, boolean $secure = false, boolean $httpOnly = true )
$name string
$path string
$domain string
$secure boolean
$httpOnly boolean

computeCacheControlValue() protected method

This considers several other headers and calculates or modifies the cache-control header to a sensible, conservative value.
protected computeCacheControlValue ( ) : string
return string

getCacheControlDirective() public method

public getCacheControlDirective ( $key )

getCookies() public method

Returns an array with all cookies.
public getCookies ( string $format = self::COOKIES_FLAT ) : array
$format string
return array

hasCacheControlDirective() public method

public hasCacheControlDirective ( $key )

makeDisposition() public method

Generates a HTTP Content-Disposition field-value.
See also: RFC 6266
public makeDisposition ( string $disposition, string $filename, string $filenameFallback = '' ) : string
$disposition string One of "inline" or "attachment"
$filename string A unicode string
$filenameFallback string A string containing only ASCII characters that is semantically equivalent to $filename. If the filename is already ASCII, it can be omitted, or just copied from $filename
return string A string suitable for use as a Content-Disposition field-value

remove() public method

public remove ( $key )

removeCookie() public method

Removes a cookie from the array, but does not unset it in the browser.
public removeCookie ( string $name, string $path = '/', string $domain = null )
$name string
$path string
$domain string

replace() public method

public replace ( array $headers = [] )
$headers array

set() public method

public set ( $key, $values, $replace = true )

setCookie() public method

Sets a cookie.
public setCookie ( Cookie $cookie )
$cookie Cookie

Property Details

$computedCacheControl protected property

protected array $computedCacheControl
return array

$cookies protected property

protected array $cookies
return array

$headerNames protected property

protected array $headerNames
return array