HeaderBag::replace()

replace(array $headers = array()) Replaces the current HTTP headers by a new set. Parameters array $headers An array of HTTP headers

HeaderBag::getDate()

null|DateTime getDate(string $key, DateTime $default = null) Returns the HTTP header value converted to a date. Parameters string $key The parameter key DateTime $default The default value Return Value null|DateTime The parsed DateTime or the default value if the header does not exist Exceptions RuntimeException When the HTTP header is not parseable

HeaderBag::remove()

remove(string $key) Removes a header. Parameters string $key The HTTP header name

HeaderBag::keys()

array keys() Returns the parameter keys. Return Value array An array of parameter keys

HeaderBag::getCacheControlDirective()

mixed|null getCacheControlDirective(string $key) Returns a Cache-Control directive value by name. Parameters string $key The directive name Return Value mixed|null The directive value if defined, null otherwise

HeaderBag::getIterator()

ArrayIterator getIterator() Returns an iterator for headers. Return Value ArrayIterator An \ArrayIterator instance

HeaderBag::has()

bool has(string $key) Returns true if the HTTP header is defined. Parameters string $key The HTTP header Return Value bool true if the parameter exists, false otherwise

HeaderBag::hasCacheControlDirective()

bool hasCacheControlDirective(string $key) Returns true if the Cache-Control directive is defined. Parameters string $key The Cache-Control directive Return Value bool true if the directive exists, false otherwise

HeaderBag::addCacheControlDirective()

addCacheControlDirective(string $key, mixed $value = true) Adds a custom Cache-Control directive. Parameters string $key The Cache-Control directive name mixed $value The Cache-Control directive value

HeaderBag::add()

add(array $headers) Adds new headers the current HTTP headers set. Parameters array $headers An array of HTTP headers