Fully Qualified Name: | Laminas\Http\Headers |
Implements: | Countable, Iterator |
Basic HTTP headers collection functionality Handles aggregation of headers
Name | Description | Defined By |
---|---|---|
addHeader() | Add a Header to this container, for raw values @see addHeaderLine() and addHeaders() | Headers |
addHeaderLine() | Add a raw header line, either in name => value, or as a single string 'name: value' | Headers |
addHeaders() | Add many headers at once | Headers |
clearHeaders() | Clear all headers | Headers |
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 | Headers |
current() | Return the current value for this iterator, lazy loading it if need be | Headers |
forceLoading() | By calling this, it will force parsing and loading of all headers, after this count() will be accurate | Headers |
fromString() | Populates headers from string representation | Headers |
get() | Get all headers of a certain name/type | Headers |
getPluginClassLoader() | Return an instance of a PluginClassLocator, lazyload and inject map if necessary | Headers |
has() | Test for existence of a type of header | Headers |
key() | Return the current key for this object as an iterator | Headers |
next() | Advance the pointer for this object as an iterator | Headers |
removeHeader() | Remove a Header from the container | Headers |
rewind() | Reset the internal pointer for this object as an iterator | Headers |
setPluginClassLoader() | Set an alternate implementation for the PluginClassLoader | Headers |
toArray() | Return the headers container as an array | Headers |
toString() | Render all headers at once | Headers |
valid() | Is this iterator still valid? | Headers |
Add a Header to this container, for raw values @see addHeaderLine() and addHeaders()
Parameter Name | Type | Description |
---|---|---|
$header | \Header\HeaderInterface |
Returns: $this
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()
Parameter Name | Type | Description |
---|---|---|
$headerFieldNameOrLine | string | |
$fieldValue | string | optional |
Returns: $this
Add many headers at once
Expects an array (or Traversable object) of type/value pairs.
Parameter Name | Type | Description |
---|---|---|
$headers | array|\Traversable |
Returns: $this
Clear all headers
Removes all headers from queue
Returns: $this
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
Returns: int count of currently known headers
Return the current value for this iterator, lazy loading it if need be
Returns: array|\Header\HeaderInterface
By calling this, it will force parsing and loading of all headers, after this count() will be accurate
Returns: bool
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)
Parameter Name | Type | Description |
---|---|---|
$string | string |
Returns: static
Get all headers of a certain name/type
Parameter Name | Type | Description |
---|---|---|
$name | string |
Returns: bool|\Header\HeaderInterface|\ArrayIterator
Return an instance of a PluginClassLocator, lazyload and inject map if necessary
Returns: \PluginClassLocator
Test for existence of a type of header
Parameter Name | Type | Description |
---|---|---|
$name | string |
Returns: bool
Return the current key for this object as an iterator
Returns: mixed
Advance the pointer for this object as an iterator
Returns: void
Remove a Header from the container
Parameter Name | Type | Description |
---|---|---|
$header | \Header\HeaderInterface |
Returns: bool
Reset the internal pointer for this object as an iterator
Returns: void
Set an alternate implementation for the PluginClassLoader
Parameter Name | Type | Description |
---|---|---|
$pluginClassLoader | \PluginClassLocator |
Returns: $this
Return the headers container as an array
Returns: array
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.
Returns: string
Is this iterator still valid?
Returns: bool