Basic HTTP headers collection functionality Handles aggregation of headers

category Zend
package Zend_Http
see \Zend\Http\http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2

 Methods

Add a Header to this container, for raw values @see addHeaderLine() and addHeaders()

addHeader(\Zend\Http\Header\HeaderInterface $header) : \Zend\Http\Headers

Add a raw header line, either in name => value, or as a single string 'name: value'

addHeaderLine(string $headerFieldNameOrLine, string $fieldValue) : \Zend\Http\Headers

This method allows for lazy-loading in that the parsing and instantiation of Header object will be delayed until they are retrieved by either get() or current()

Parameters

$headerFieldNameOrLine

string

$fieldValue

string

optional

Exceptions

\Zend\Http\Exception\InvalidArgumentException

Returns

Add many headers at once

addHeaders(array | \Traversable $headers) : \Zend\Http\Headers

Expects an array (or Traversable object) of type/value pairs.

Parameters

$headers

array\Traversable

Exceptions

\Zend\Http\Exception\InvalidArgumentException

Returns

Clear all headers

clearHeaders() : \Zend\Http\Headers

Removes all headers from queue

Returns

Return the number of headers in this contain, if all headers have not been parsed, actual count could increase if MultipleHeader objects exist in the Request/Response.

count() : int

If you need an exact count, iterate

Returns

intcount of currently known headers

Return the current value for this iterator, lazy loading it if need be

current() : array | \Zend\Http\Header\HeaderInterface

By calling this, it will force parsing and loading of all headers, after this count() will be accurate

forceLoading() : bool

Returns

bool

Populates headers from string representation

fromString(string $string) : \Zend\Http\Headers

Parses a string for headers, and aggregates them, in order, in the current instance, primarily as strings until they are needed (they will be lazy loaded)

Parameters

$string

string

Exceptions

\Zend\Http\Exception\RuntimeException

Returns

Get all headers of a certain name/type

get(string $name) : bool | \Zend\Http\Header\HeaderInterface | \ArrayIterator

Parameters

$name

string

Returns

Return an instance of a PluginClassLocator, lazyload and inject map if necessary

getPluginClassLoader() : \Zend\Loader\PluginClassLocator

Test for existence of a type of header

has(string $name) : bool

Parameters

$name

string

Returns

bool

Return the current key for this object as an iterator

key() : mixed

Returns

mixed

Remove a Header from the container

removeHeader(\Zend\Http\Header\HeaderInterface $header) : bool

Parameters

Returns

bool

Reset the internal pointer for this object as an iterator

rewind() : void

Set an alternate implementation for the PluginClassLoader

setPluginClassLoader(\Zend\Loader\PluginClassLocator $pluginClassLoader) : \Zend\Http\Headers

Parameters

$pluginClassLoader

\Zend\Loader\PluginClassLocator

Returns

Return the headers container as an array

toArray() : array

todo determine how to produce single line headers, if they are supported

Returns

array

Render all headers at once

toString() : string

This method handles the normal iteration of headers; it is up to the concrete classes to prepend with the appropriate status/request line.

Returns

string

Is this iterator still valid?

valid() : bool

Returns

bool

Create array key from header name

createKey(string $name) : string

Parameters

$name

string

Returns

string

lazyLoadHeader()

lazyLoadHeader($index) : mixed | void

Parameters

$index

Returns

mixedvoid

 Properties

 

<p>Array of header array information or Header instances</p>

$headers : array

 

<p>key names for $headers array</p>

$headersKeys : array

 

$pluginClassLoader

$pluginClassLoader : \Zend\Loader\PluginClassLoader