Overview

Namespaces

  • Composer
    • Autoload
  • Guzzle
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
        • Header
      • QueryAggregator
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Mock
    • Stream
  • Mockery
    • Adapter
      • Phpunit
    • CountValidator
    • Exception
    • Generator
      • StringManipulation
        • Pass
    • Loader
    • Matcher
  • None
  • Omnipay
    • Common
      • Exception
      • Message
    • Dummy
      • Message
    • Fatzebra
      • Message
  • PHP
  • Symfony
    • Component
      • EventDispatcher
        • Debug
        • DependencyInjection
        • Tests
          • Debug
          • DependencyInjection
      • HttpFoundation
        • File
          • Exception
          • MimeType
        • Session
          • Attribute
          • Flash
          • Storage
            • Handler
            • Proxy
        • Tests
          • File
            • MimeType
          • Session
            • Attribute
            • Flash
            • Storage
              • Handler
              • Proxy
      • Yaml
        • Exception
        • Tests

Classes

  • AcceptHeader
  • AcceptHeaderItem
  • ApacheRequest
  • BinaryFileResponse
  • Cookie
  • ExpressionRequestMatcher
  • FileBag
  • HeaderBag
  • IpUtils
  • JsonResponse
  • ParameterBag
  • RedirectResponse
  • Request
  • RequestMatcher
  • RequestStack
  • Response
  • ResponseHeaderBag
  • ServerBag
  • StreamedResponse

Interfaces

  • RequestMatcherInterface
  • Overview
  • Namespace
  • Class
  • Tree

Class HeaderBag

HeaderBag is a container for HTTP headers.

Symfony\Component\HttpFoundation\HeaderBag implements IteratorAggregate, Countable

Direct known subclasses

Symfony\Component\HttpFoundation\ResponseHeaderBag
Namespace: Symfony\Component\HttpFoundation
Author: Fabien Potencier fabien@symfony.com
Api
Located at HeaderBag.php
Methods summary
public
# __construct( array $headers = array() )

Constructor.

Constructor.

Parameters

$headers
An array of HTTP headers

Api

public string
# __toString( )

Returns the headers as a string.

Returns the headers as a string.

Returns

string
The headers
public array
# all( )

Returns the headers.

Returns the headers.

Returns

array
An array of headers

Api

public array
# keys( )

Returns the parameter keys.

Returns the parameter keys.

Returns

array
An array of parameter keys

Api

public
# replace( array $headers = array() )

Replaces the current HTTP headers by a new set.

Replaces the current HTTP headers by a new set.

Parameters

$headers
An array of HTTP headers

Api

public
# add( array $headers )

Adds new headers the current HTTP headers set.

Adds new headers the current HTTP headers set.

Parameters

$headers
An array of HTTP headers

Api

public string|array
# get( string $key, mixed $default = null, boolean $first = true )

Returns a header value by name.

Returns a header value by name.

Parameters

$key
The header name
$default
The default value
$first
Whether to return the first value or all header values

Returns

string|array
The first header value if $first is true, an array of values otherwise

Api

public
# set( string $key, string|array $values, boolean $replace = true )

Sets a header by name.

Sets a header by name.

Parameters

$key
The key
$values
The value or an array of values
$replace
Whether to replace the actual value or not (true by default)

Api

public boolean
# has( string $key )

Returns true if the HTTP header is defined.

Returns true if the HTTP header is defined.

Parameters

$key
The HTTP header

Returns

boolean
true if the parameter exists, false otherwise

Api

public boolean
# contains( string $key, string $value )

Returns true if the given HTTP header contains the given value.

Returns true if the given HTTP header contains the given value.

Parameters

$key
The HTTP header name
$value
The HTTP value

Returns

boolean
true if the value is contained in the header, false otherwise

Api

public
# remove( string $key )

Removes a header.

Removes a header.

Parameters

$key
The HTTP header name

Api

public null|DateTime
# getDate( string $key, DateTime $default = null )

Returns the HTTP header value converted to a date.

Returns the HTTP header value converted to a date.

Parameters

$key
The parameter key
$default
The default value

Returns

null|DateTime
The parsed DateTime or the default value if the header does not exist

Throws

RuntimeException
When the HTTP header is not parseable

Api

public
# addCacheControlDirective( string $key, mixed $value = true )

Adds a custom Cache-Control directive.

Adds a custom Cache-Control directive.

Parameters

$key
The Cache-Control directive name
$value
The Cache-Control directive value
public boolean
# hasCacheControlDirective( string $key )

Returns true if the Cache-Control directive is defined.

Returns true if the Cache-Control directive is defined.

Parameters

$key
The Cache-Control directive

Returns

boolean
true if the directive exists, false otherwise
public mixed|null
# getCacheControlDirective( string $key )

Returns a Cache-Control directive value by name.

Returns a Cache-Control directive value by name.

Parameters

$key
The directive name

Returns

mixed|null
The directive value if defined, null otherwise
public
# removeCacheControlDirective( string $key )

Removes a Cache-Control directive.

Removes a Cache-Control directive.

Parameters

$key
The Cache-Control directive
public ArrayIterator
# getIterator( )

Returns an iterator for headers.

Returns an iterator for headers.

Returns

ArrayIterator
An \ArrayIterator instance

Implementation of

IteratorAggregate::getIterator()
public integer
# count( )

Returns the number of headers.

Returns the number of headers.

Returns

integer
The number of headers

Implementation of

Countable::count()
protected
# getCacheControlHeader( )
protected array
# parseCacheControl( string $header )

Parses a Cache-Control HTTP header.

Parses a Cache-Control HTTP header.

Parameters

$header
The value of the Cache-Control HTTP header

Returns

array
An array representing the attribute values
Properties summary
protected array $headers
# array()
protected array $cacheControl
# array()
Omnipay Fat Zebra / Paystream Gateway Module API Documentation API documentation generated by ApiGen