Open Journal Systems  3.3.0
Symfony\Component\HttpFoundation\HeaderBag Class Reference
Inheritance diagram for Symfony\Component\HttpFoundation\HeaderBag:
Symfony\Component\HttpFoundation\ResponseHeaderBag

Public Member Functions

 __construct (array $headers=[])
 
 __construct (array $headers=array())
 
 __toString ()
 
 __toString ()
 
 add (array $headers)
 
 add (array $headers)
 
 addCacheControlDirective ($key, $value=true)
 
 addCacheControlDirective ($key, $value=true)
 
 all ()
 
 all ()
 
 contains ($key, $value)
 
 contains ($key, $value)
 
 count ()
 
 count ()
 
 get ($key, $default=null)
 
 get ($key, $default=null, $first=true)
 
 getCacheControlDirective ($key)
 
 getCacheControlDirective ($key)
 
 getDate ($key, \DateTime $default=null)
 
 getDate ($key, \DateTime $default=null)
 
 getIterator ()
 
 getIterator ()
 
 has ($key)
 
 has ($key)
 
 hasCacheControlDirective ($key)
 
 hasCacheControlDirective ($key)
 
 keys ()
 
 keys ()
 
 remove ($key)
 
 remove ($key)
 
 removeCacheControlDirective ($key)
 
 removeCacheControlDirective ($key)
 
 replace (array $headers=[])
 
 replace (array $headers=array())
 
 set ($key, $values, $replace=true)
 
 set ($key, $values, $replace=true)
 

Protected Member Functions

 getCacheControlHeader ()
 
 getCacheControlHeader ()
 
 parseCacheControl ($header)
 
 parseCacheControl ($header)
 

Protected Attributes

 $cacheControl = array()
 
 $headers = array()
 
const LOWER = '-abcdefghijklmnopqrstuvwxyz'
 
const UPPER = '_ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 

Detailed Description

HeaderBag is a container for HTTP headers.

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Definition at line 19 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

Constructor & Destructor Documentation

◆ __construct() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::__construct ( array  $headers = array())

◆ __construct() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::__construct ( array  $headers = [])

Member Function Documentation

◆ __toString() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::__toString ( )

Returns the headers as a string.

Returns
string The headers

Definition at line 39 of file vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\$headers, and Symfony\Component\HttpFoundation\HeaderBag\all().

◆ __toString() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::__toString ( )

Returns the headers as a string.

Returns
string The headers

Definition at line 41 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\$headers, and Symfony\Component\HttpFoundation\HeaderBag\all().

◆ add() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::add ( array  $headers)

Adds new headers the current HTTP headers set.

Parameters
array$headersAn array of HTTP headers

Definition at line 96 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\$headers.

Referenced by Symfony\Component\HttpFoundation\HeaderBag\replace().

◆ add() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::add ( array  $headers)

Adds new headers the current HTTP headers set.

Definition at line 96 of file vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\$headers.

◆ addCacheControlDirective() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::addCacheControlDirective (   $key,
  $value = true 
)

Adds a custom Cache-Control directive.

Parameters
string$keyThe Cache-Control directive name
mixed$valueThe Cache-Control directive value

Definition at line 226 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\getCacheControlHeader().

◆ addCacheControlDirective() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::addCacheControlDirective (   $key,
  $value = true 
)

Adds a custom Cache-Control directive.

Parameters
string$keyThe Cache-Control directive name
mixed$valueThe Cache-Control directive value

Definition at line 234 of file vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\getCacheControlHeader().

◆ all() [1/2]

◆ all() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::all ( )

Returns the headers.

Parameters
string | null$keyThe name of the headers to return or null to get them all
Returns
array An array of headers

Reimplemented in Symfony\Component\HttpFoundation\ResponseHeaderBag, and Symfony\Component\HttpFoundation\ResponseHeaderBag.

Definition at line 65 of file vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\$headers.

◆ contains() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::contains (   $key,
  $value 
)

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

Parameters
string$keyThe HTTP header name
string$valueThe HTTP value
Returns
bool true if the value is contained in the header, false otherwise

Definition at line 176 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

◆ contains() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::contains (   $key,
  $value 
)

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

Parameters
string$keyThe HTTP header name
string$valueThe HTTP value
Returns
bool true if the value is contained in the header, false otherwise

Definition at line 185 of file vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\all().

◆ count() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::count ( )

Returns the number of headers.

Returns
int The number of headers

Definition at line 284 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

Referenced by Symfony\Component\HttpFoundation\HeaderBag\get().

◆ count() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::count ( )

Returns the number of headers.

Returns
int The number of headers

Definition at line 292 of file vendor/symfony/http-foundation/HeaderBag.php.

◆ get() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::get (   $key,
  $default = null 
)

Returns a header value by name.

Parameters
string$keyThe header name
string | null$defaultThe default value
Returns
string|null The first header value or default value

Definition at line 111 of file vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\$headers, and Symfony\Component\HttpFoundation\HeaderBag\all().

◆ get() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::get (   $key,
  $default = null,
  $first = true 
)

Returns a header value by name.

Parameters
string$keyThe header name
mixed$defaultThe default value
bool$firstWhether 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

Definition at line 112 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\$headers, Symfony\Component\HttpFoundation\HeaderBag\all(), and Symfony\Component\HttpFoundation\HeaderBag\count().

◆ getCacheControlDirective() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::getCacheControlDirective (   $key)

Returns a Cache-Control directive value by name.

Parameters
string$keyThe directive name
Returns
mixed|null The directive value if defined, null otherwise

Reimplemented in Symfony\Component\HttpFoundation\ResponseHeaderBag, and Symfony\Component\HttpFoundation\ResponseHeaderBag.

Definition at line 252 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

◆ getCacheControlDirective() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::getCacheControlDirective (   $key)

Returns a Cache-Control directive value by name.

Parameters
string$keyThe directive name
Returns
mixed|null The directive value if defined, null otherwise

Reimplemented in Symfony\Component\HttpFoundation\ResponseHeaderBag, and Symfony\Component\HttpFoundation\ResponseHeaderBag.

Definition at line 260 of file vendor/symfony/http-foundation/HeaderBag.php.

◆ getCacheControlHeader() [1/2]

◆ getCacheControlHeader() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::getCacheControlHeader ( )
protected

◆ getDate() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::getDate (   $key,
\DateTime  $default = null 
)

Returns the HTTP header value converted to a date.

Parameters
string$keyThe parameter key
\DateTime$defaultThe default value
Returns
null|\DateTime The parsed DateTime or the default value if the header does not exist
Exceptions

Definition at line 207 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

◆ getDate() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::getDate (   $key,
\DateTime  $default = null 
)

Returns the HTTP header value converted to a date.

Parameters
string$keyThe parameter key
Returns
\DateTimeInterface|null The parsed DateTime or the default value if the header does not exist
Exceptions

Definition at line 215 of file vendor/symfony/http-foundation/HeaderBag.php.

◆ getIterator() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::getIterator ( )

Returns an iterator for headers.

Returns
\ArrayIterator An \ArrayIterator instance

Definition at line 274 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

◆ getIterator() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::getIterator ( )

Returns an iterator for headers.

Returns
\ArrayIterator An \ArrayIterator instance

Definition at line 282 of file vendor/symfony/http-foundation/HeaderBag.php.

◆ has() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::has (   $key)

Returns true if the HTTP header is defined.

Parameters
string$keyThe HTTP header
Returns
bool true if the parameter exists, false otherwise

Definition at line 163 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\all().

Referenced by Symfony\Component\HttpFoundation\ResponseHeaderBag\computeCacheControlValue().

◆ has() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::has (   $key)

Returns true if the HTTP header is defined.

Parameters
string$keyThe HTTP header
Returns
bool true if the parameter exists, false otherwise

Definition at line 172 of file vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\all().

◆ hasCacheControlDirective() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::hasCacheControlDirective (   $key)

Returns true if the Cache-Control directive is defined.

Parameters
string$keyThe Cache-Control directive
Returns
bool true if the directive exists, false otherwise

Reimplemented in Symfony\Component\HttpFoundation\ResponseHeaderBag, and Symfony\Component\HttpFoundation\ResponseHeaderBag.

Definition at line 240 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

◆ hasCacheControlDirective() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::hasCacheControlDirective (   $key)

Returns true if the Cache-Control directive is defined.

Parameters
string$keyThe Cache-Control directive
Returns
bool true if the directive exists, false otherwise

Reimplemented in Symfony\Component\HttpFoundation\ResponseHeaderBag, and Symfony\Component\HttpFoundation\ResponseHeaderBag.

Definition at line 248 of file vendor/symfony/http-foundation/HeaderBag.php.

◆ keys() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::keys ( )

Returns the parameter keys.

Returns
array An array of parameter keys

Definition at line 75 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\all().

◆ keys() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::keys ( )

Returns the parameter keys.

Returns
array An array of parameter keys

Definition at line 79 of file vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\all().

◆ parseCacheControl() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::parseCacheControl (   $header)
protected

Parses a Cache-Control HTTP header.

Parameters
string$headerThe value of the Cache-Control HTTP header
Returns
array An array representing the attribute values

Definition at line 311 of file vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderUtils\combine(), and Symfony\Component\HttpFoundation\HeaderUtils\split().

◆ parseCacheControl() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::parseCacheControl (   $header)
protected

Parses a Cache-Control HTTP header.

Parameters
string$headerThe value of the Cache-Control HTTP header
Returns
array An array representing the attribute values

Definition at line 315 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\$cacheControl.

Referenced by Symfony\Component\HttpFoundation\ResponseHeaderBag\set(), and Symfony\Component\HttpFoundation\HeaderBag\set().

◆ remove() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::remove (   $key)

Removes a header.

Parameters
string$keyThe HTTP header name

Reimplemented in Symfony\Component\HttpFoundation\ResponseHeaderBag, and Symfony\Component\HttpFoundation\ResponseHeaderBag.

Definition at line 186 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

◆ remove() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::remove (   $key)

Removes a header.

Parameters
string$keyThe HTTP header name

Reimplemented in Symfony\Component\HttpFoundation\ResponseHeaderBag, and Symfony\Component\HttpFoundation\ResponseHeaderBag.

Definition at line 195 of file vendor/symfony/http-foundation/HeaderBag.php.

◆ removeCacheControlDirective() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::removeCacheControlDirective (   $key)

Removes a Cache-Control directive.

Parameters
string$keyThe Cache-Control directive

Definition at line 262 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\getCacheControlHeader().

◆ removeCacheControlDirective() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::removeCacheControlDirective (   $key)

Removes a Cache-Control directive.

Parameters
string$keyThe Cache-Control directive

Definition at line 270 of file vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\getCacheControlHeader().

◆ replace() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::replace ( array  $headers = [])

◆ replace() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::replace ( array  $headers = array())

Replaces the current HTTP headers by a new set.

Parameters
array$headersAn array of HTTP headers

Reimplemented in Symfony\Component\HttpFoundation\ResponseHeaderBag, and Symfony\Component\HttpFoundation\ResponseHeaderBag.

Definition at line 85 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\$headers, and Symfony\Component\HttpFoundation\HeaderBag\add().

◆ set() [1/2]

Symfony\Component\HttpFoundation\HeaderBag::set (   $key,
  $values,
  $replace = true 
)

Sets a header by name.

Parameters
string$keyThe key
string | array$valuesThe value or an array of values
bool$replaceWhether to replace the actual value or not (true by default)

Reimplemented in Symfony\Component\HttpFoundation\ResponseHeaderBag, and Symfony\Component\HttpFoundation\ResponseHeaderBag.

Definition at line 139 of file lib/vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\parseCacheControl().

◆ set() [2/2]

Symfony\Component\HttpFoundation\HeaderBag::set (   $key,
  $values,
  $replace = true 
)

Sets a header by name.

Parameters
string$keyThe key
string | string[]$valuesThe value or an array of values
bool$replaceWhether to replace the actual value or not (true by default)

Reimplemented in Symfony\Component\HttpFoundation\ResponseHeaderBag, and Symfony\Component\HttpFoundation\ResponseHeaderBag.

Definition at line 140 of file vendor/symfony/http-foundation/HeaderBag.php.

References Symfony\Component\HttpFoundation\HeaderBag\parseCacheControl().

Field Documentation

◆ $cacheControl

Symfony\Component\HttpFoundation\HeaderBag::$cacheControl = array()
protected

◆ $headers

◆ LOWER

const Symfony\Component\HttpFoundation\HeaderBag::LOWER = '-abcdefghijklmnopqrstuvwxyz'
protected

Definition at line 22 of file vendor/symfony/http-foundation/HeaderBag.php.

◆ UPPER

const Symfony\Component\HttpFoundation\HeaderBag::UPPER = '_ABCDEFGHIJKLMNOPQRSTUVWXYZ'
protected

Definition at line 21 of file vendor/symfony/http-foundation/HeaderBag.php.


The documentation for this class was generated from the following file: