class ResponseHeaderBag extends HeaderBag
ResponseHeaderBag is a container for Response HTTP headers.
| COOKIES_FLAT | |
| COOKIES_ARRAY | |
| DISPOSITION_ATTACHMENT | |
| DISPOSITION_INLINE |
| protected | $headers | from HeaderBag | |
| protected | $cacheControl | from HeaderBag | |
| protected | $computedCacheControl | ||
| protected | $cookies | ||
| protected | $headerNames |
| __construct(array $headers = array()) | ||
| string | __toString() Returns the headers as a string. | from HeaderBag |
| array | all() Returns the headers. | |
| array | keys() Returns the parameter keys. | from HeaderBag |
| replace(array $headers = array()) Replaces the current HTTP headers by a new set. | ||
| add(array $headers) Adds new headers the current HTTP headers set. | from HeaderBag | |
| string|string[]|null | get(string $key, string|string[]|null $default = null, bool $first = true) Returns a header value by name. | from HeaderBag |
| set(string $key, string|string[] $values, bool $replace = true) Sets a header by name. | ||
| bool | has(string $key) Returns true if the HTTP header is defined. | from HeaderBag |
| bool | contains(string $key, string $value) Returns true if the given HTTP header contains the given value. | from HeaderBag |
| remove(string $key) Removes a header. | ||
| DateTime|null | getDate(string $key, DateTime $default = null) Returns the HTTP header value converted to a date. | from HeaderBag |
| addCacheControlDirective(string $key, mixed $value = true) Adds a custom Cache-Control directive. | from HeaderBag | |
| bool | hasCacheControlDirective(string $key) Returns true if the Cache-Control directive is defined. | |
| mixed|null | getCacheControlDirective(string $key) Returns a Cache-Control directive value by name. | |
| removeCacheControlDirective(string $key) Removes a Cache-Control directive. | from HeaderBag | |
| ArrayIterator | getIterator() Returns an iterator for headers. | from HeaderBag |
| int | count() Returns the number of headers. | from HeaderBag |
| getCacheControlHeader() | from HeaderBag | |
| array | parseCacheControl(string $header) Parses a Cache-Control HTTP header. | from HeaderBag |
| array | allPreserveCase() Returns the headers, with original capitalizations. | |
| allPreserveCaseWithoutCookies() | ||
| setCookie(Cookie $cookie) | ||
| removeCookie(string $name, string $path = '/', string $domain = null) Removes a cookie from the array, but does not unset it in the browser. | ||
| Cookie[] | getCookies(string $format = self::COOKIES_FLAT) Returns an array with all cookies. | |
| clearCookie(string $name, string $path = '/', string $domain = null, bool $secure = false, bool $httpOnly = true) Clears a cookie in the browser. | ||
| string | makeDisposition(string $disposition, string $filename, string $filenameFallback = '') Generates a HTTP Content-Disposition field-value. | |
| string | computeCacheControlValue() Returns the calculated value of the cache-control header. |
| array | $headers | An array of HTTP headers |
Returns the headers as a string.
| string | The headers |
Returns the headers.
| array | An array of headers |
Returns the parameter keys.
| array | An array of parameter keys |
Replaces the current HTTP headers by a new set.
| array | $headers | An array of HTTP headers |
Adds new headers the current HTTP headers set.
| array | $headers | An array of HTTP headers |
Returns a header value by name.
| string | $key | The header name |
| string|string[]|null | $default | The default value |
| bool | $first | Whether to return the first value or all header values |
| string|string[]|null | The first header value or default value if $first is true, an array of values otherwise |
Sets a header by name.
| string | $key | The key |
| string|string[] | $values | The value or an array of values |
| bool | $replace | Whether to replace the actual value or not (true by default) |
Returns true if the HTTP header is defined.
| string | $key | The HTTP header |
| bool | true if the parameter exists, false otherwise |
Returns true if the given HTTP header contains the given value.
| string | $key | The HTTP header name |
| string | $value | The HTTP value |
| bool | true if the value is contained in the header, false otherwise |
Removes a header.
| string | $key | The HTTP header name |
Returns the HTTP header value converted to a date.
| string | $key | The parameter key |
| DateTime | $default | The default value |
| DateTime|null | The parsed DateTime or the default value if the header does not exist |
| RuntimeException | When the HTTP header is not parseable |
Adds a custom Cache-Control directive.
| string | $key | The Cache-Control directive name |
| mixed | $value | The Cache-Control directive value |
Returns true if the Cache-Control directive is defined.
| string | $key | The Cache-Control directive |
| bool | true if the directive exists, false otherwise |
Returns a Cache-Control directive value by name.
| string | $key | The directive name |
| mixed|null | The directive value if defined, null otherwise |
Removes a Cache-Control directive.
| string | $key | The Cache-Control directive |
Returns an iterator for headers.
| ArrayIterator | An \ArrayIterator instance |
Returns the number of headers.
| int | The number of headers |
Parses a Cache-Control HTTP header.
| string | $header | The value of the Cache-Control HTTP header |
| array | An array representing the attribute values |
Returns the headers, with original capitalizations.
| array | An array of headers |
| Cookie | $cookie |
Removes a cookie from the array, but does not unset it in the browser.
| string | $name | |
| string | $path | |
| string | $domain |
Returns an array with all cookies.
| string | $format |
| Cookie[] |
| InvalidArgumentException | When the $format is invalid |
Clears a cookie in the browser.
| string | $name | |
| string | $path | |
| string | $domain | |
| bool | $secure | |
| bool | $httpOnly |
Generates a HTTP Content-Disposition field-value.
| string | $disposition | One of "inline" or "attachment" |
| string | $filename | A unicode string |
| string | $filenameFallback | 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 |
| string | A string suitable for use as a Content-Disposition field-value |
| InvalidArgumentException |
| RFC | 6266 |
Returns the calculated value of the cache-control header.
This considers several other headers and calculates or modifies the cache-control header to a sensible, conservative value.
| string |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/HttpFoundation/ResponseHeaderBag.html