Fully Qualified Name: | Zend\Mail\Headers |
Implements: | Countable, Iterator |
Basic mail headers collection functionality
Handles aggregation of headers
Name | Description | Defined By |
---|---|---|
addHeader() | Add a Header\Interface to this container, for raw values see {@link addHeaderLine()} and {@link 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 |
getEncoding() | Get the header encoding | 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 |
loadHeader() | Create Header object from header line | 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 |
setEncoding() | Set the header encoding | 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\Interface to this container, for raw values see {@link addHeaderLine()} and {@link addHeaders()}
Parameter Name | Type | Description |
---|---|---|
$header | \Header\HeaderInterface |
Returns: \Headers
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 HeaderInterface object will be delayed until they are retrieved by either get() or current()
Parameter Name | Type | Description |
---|---|---|
$headerFieldNameOrLine | string | |
$fieldValue | string | optional |
Returns: \Headers
Add many headers at once
Expects an array (or Traversable object) of type/value pairs.
Parameter Name | Type | Description |
---|---|---|
$headers | array|\Traversable |
Returns: \Headers
Clear all headers
Removes all headers from queue
Returns: \Headers
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: \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 | |
$EOL | string | EOL |
Returns: \Headers
Get all headers of a certain name/type
Parameter Name | Type | Description |
---|---|---|
$name | string |
Returns: bool|\ArrayIterator|\Header\HeaderInterface Returns false if there is no headers with $name in this contain, an ArrayIterator if the header is a MultipleHeadersInterface instance and finally returns HeaderInterface for the rest of cases.
Get the header encoding
Returns: string
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
Create Header object from header line
Parameter Name | Type | Description |
---|---|---|
$headerLine | string |
Returns: \Header\HeaderInterface|\Header\HeaderInterface[]
Advance the pointer for this object as an iterator
Returns:
Remove a Header from the container
Parameter Name | Type | Description |
---|---|---|
$ | string|\Header\HeaderInterface | field |
$instanceOrFieldName |
Returns: bool
Reset the internal pointer for this object as an iterator
Returns:
Set the header encoding
Parameter Name | Type | Description |
---|---|---|
$encoding | string |
Returns: \Headers
Set an alternate implementation for the PluginClassLoader
Parameter Name | Type | Description |
---|---|---|
$pluginClassLoader | \PluginClassLocator |
Returns: \Headers
Return the headers container as an array
Parameter Name | Type | Description |
---|---|---|
$format | bool | Return |
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