Zend Framework
3.0
|
Basic mail headers collection functionality. More...
Public Member Functions | |
setPluginClassLoader (PluginClassLocator $pluginClassLoader) | |
Set an alternate implementation for the PluginClassLoader. | |
getPluginClassLoader () | |
Return an instance of a PluginClassLocator, lazyload and inject map if necessary. | |
setEncoding ($encoding) | |
Set the header encoding. | |
getEncoding () | |
Get the header encoding. | |
addHeaders ($headers) | |
Add many headers at once. | |
addHeaderLine ($headerFieldNameOrLine, $fieldValue=null) | |
Add a raw header line, either in name => value, or as a single string 'name: value'. | |
addHeader (Header\HeaderInterface $header) | |
Add a Header to this container, for raw values see addHeaderLine() and addHeaders(). | |
removeHeader ($instanceOrFieldName) | |
Remove a Header from the container. | |
clearHeaders () | |
Clear all headers. | |
get ($name) | |
Get all headers of a certain name/type. | |
has ($name) | |
Test for existence of a type of header. | |
next () | |
Advance the pointer for this object as an iterator. | |
key () | |
Return the current key for this object as an iterator. | |
valid () | |
Is this iterator still valid? | |
rewind () | |
Reset the internal pointer for this object as an iterator. | |
current () | |
Return the current value for this iterator, lazy loading it if need be. | |
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. | |
toString () | |
Render all headers at once. | |
toArray ($format=Header\HeaderInterface::FORMAT_RAW) | |
Return the headers container as an array. | |
forceLoading () | |
By calling this, it will force parsing and loading of all headers, after this count() will be accurate. | |
loadHeader ($headerLine) | |
Create Header object from header line. | |
Static Public Member Functions | |
static | fromString ($string, $EOL=self::EOL) |
Populates headers from string representation. | |
Public Attributes | |
const | EOL = "\r\n" |
const | FOLDING = "\r\n " |
Protected Member Functions | |
lazyLoadHeader ($index) | |
normalizeFieldName ($fieldName) | |
Normalize a field name. | |
Protected Attributes | |
$pluginClassLoader = null | |
$headersKeys = [] | |
$headers = [] | |
$encoding = 'ASCII' | |
Basic mail headers collection functionality.
Handles aggregation of headers
addHeader | ( | Header\HeaderInterface | $header | ) |
Add a Header to this container, for raw values see addHeaderLine() and addHeaders().
Header\HeaderInterface | $header |
addHeaderLine | ( | $headerFieldNameOrLine, | |
$fieldValue = null |
|||
) |
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()
Exception\InvalidArgumentException |
string | $headerFieldNameOrLine | |
string | $fieldValue | optional |
addHeaders | ( | $headers | ) |
Add many headers at once.
Expects an array (or Traversable object) of type/value pairs.
array | Traversable | $headers |
Exception\InvalidArgumentException |
clearHeaders | ( | ) |
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
current | ( | ) |
Return the current value for this iterator, lazy loading it if need be.
forceLoading | ( | ) |
By calling this, it will force parsing and loading of all headers, after this count() will be accurate.
|
static |
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)
string | $string | |
string | $EOL | EOL string; defaults to EOL |
Exception\RuntimeException |
get | ( | $name | ) |
Get all headers of a certain name/type.
string | $name |
getEncoding | ( | ) |
Get the header encoding.
getPluginClassLoader | ( | ) |
Return an instance of a PluginClassLocator, lazyload and inject map if necessary.
has | ( | $name | ) |
key | ( | ) |
Return the current key for this object as an iterator.
|
protected |
$index |
loadHeader | ( | $headerLine | ) |
next | ( | ) |
Advance the pointer for this object as an iterator.
|
protected |
Normalize a field name.
string | $fieldName |
removeHeader | ( | $instanceOrFieldName | ) |
Remove a Header from the container.
string|Header\HeaderInterface | field name or specific header instance to remove |
rewind | ( | ) |
Reset the internal pointer for this object as an iterator.
setEncoding | ( | $encoding | ) |
setPluginClassLoader | ( | PluginClassLocator | $pluginClassLoader | ) |
Set an alternate implementation for the PluginClassLoader.
PluginClassLocator | $pluginClassLoader |
toArray | ( | $format = Header\HeaderInterface::FORMAT_RAW | ) |
Return the headers container as an array.
bool | $format | Return the values in Mime::Encoded or in Raw format |
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.
valid | ( | ) |
Is this iterator still valid?
|
protected |
|
protected |
|
protected |
|
protected |
const EOL = "\r\n" |
const FOLDING = "\r\n " |