995. Class

995.1. Zend\Http\Headers

Basic HTTP headers collection functionality Handles aggregation of headers

995.1.1. Methods

995.1.1.1. fromString

fromString()

Populates headers from string representation

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
Return type:Headers
Throws :ExceptionRuntimeException

995.1.1.2. setPluginClassLoader

setPluginClassLoader()

Set an alternate implementation for the PluginClassLoader

Parameters:ZendLoaderPluginClassLocator
Return type:Headers

995.1.1.3. getPluginClassLoader

getPluginClassLoader()

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

Return type:PluginClassLocator

995.1.1.4. addHeaders

addHeaders()

Add many headers at once

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

Parameters:array|Traversable
Return type:Headers
Throws :ExceptionInvalidArgumentException

995.1.1.5. addHeaderLine

addHeaderLine()

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

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:
  • string
  • string – optional
Return type:

Headers

995.1.1.6. addHeader

addHeader()

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

Parameters:HeaderHeaderInterface
Return type:Headers

995.1.1.7. removeHeader

removeHeader()

Remove a Header from the container

Parameters:HeaderHeaderInterface
Return type:bool

995.1.1.8. clearHeaders

clearHeaders()

Clear all headers

Removes all headers from queue

Return type:Headers

995.1.1.9. get

get()

Get all headers of a certain name/type

Parameters:string
Return type:bool|HeaderHeaderInterface|ArrayIterator

995.1.1.10. has

has()

Test for existence of a type of header

Parameters:string
Return type:bool

995.1.1.12. key

key()

Return the current key for this object as an iterator

Return type:mixed

995.1.1.13. valid

valid()

Is this iterator still valid?

Return type:bool

995.1.1.14. rewind

rewind()

Reset the internal pointer for this object as an iterator

Return type:void

995.1.1.15. current

current()

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

Return type:array|HeaderHeaderInterface

995.1.1.16. count

count()

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. If you need an exact count, iterate

Return type:int count of currently known headers

995.1.1.17. toString

toString()

Render all headers at once

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

Return type:string

995.1.1.18. toArray

toArray()

Return the headers container as an array

Return type:array

995.1.1.19. forceLoading

forceLoading()

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

Return type:bool

995.1.1.20. lazyLoadHeader

lazyLoadHeader()

@param $index

Return type:mixed|void

995.1.1.21. createKey

createKey()

Create array key from header name

Parameters:string
Return type:string