1144. Class

1144.1. Zend\Mail\Headers

Basic mail headers collection functionality

Handles aggregation of headers

1144.1.1. Methods

1144.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
  • string – EOL string; defaults to {@link EOL}
Throws ExceptionRuntimeException:
 
Return type:

Headers

1144.1.1.2. setPluginClassLoader

setPluginClassLoader()

Set an alternate implementation for the PluginClassLoader

Parameters:PluginClassLocator
Return type:Headers

1144.1.1.3. getPluginClassLoader

getPluginClassLoader()

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

Return type:PluginClassLocator

1144.1.1.4. setEncoding

setEncoding()

Set the header encoding

Parameters:string
Return type:Headers

1144.1.1.5. getEncoding

getEncoding()

Get the header encoding

Return type:string

1144.1.1.6. addHeaders

addHeaders()

Add many headers at once

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

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

1144.1.1.7. 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 HeaderInterface object will be delayed until they are retrieved by either get() or current()

Parameters:
  • string
  • string – optional
Return type:

Headers

1144.1.1.8. addHeader

addHeader()

Add a HeaderInterface to this container, for raw values see {@link addHeaderLine()} and {@link addHeaders()}

Parameters:HeaderHeaderInterface
Return type:Headers

1144.1.1.9. removeHeader

removeHeader()

Remove a Header from the container

Parameters:string
Return type:bool

1144.1.1.10. clearHeaders

clearHeaders()

Clear all headers

Removes all headers from queue

Return type:Headers

1144.1.1.11. get

get()

Get all headers of a certain name/type

Parameters:string
Return type:bool|ArrayIterator|HeaderHeaderInterface 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.

1144.1.1.12. has

has()

Test for existence of a type of header

Parameters:string
Return type:bool

1144.1.1.14. key

key()

Return the current key for this object as an iterator

Return type:mixed

1144.1.1.15. valid

valid()

Is this iterator still valid?

Return type:bool

1144.1.1.16. rewind

rewind()

Reset the internal pointer for this object as an iterator

1144.1.1.17. current

current()

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

Return type:HeaderHeaderInterface

1144.1.1.18. 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

1144.1.1.19. 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

1144.1.1.20. toArray

toArray()

Return the headers container as an array

Return type:array

1144.1.1.21. forceLoading

forceLoading()

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

Return type:bool

1144.1.1.22. lazyLoadHeader

lazyLoadHeader()

@param $index

Return type:mixed

1144.1.1.23. normalizeFieldName

normalizeFieldName()

Normalize a field name

Parameters:string
Return type:string

1144.1.2. Constants

1144.1.2.1. EOL

@var string End of Line for fields */

1144.1.2.2. FOLDING

@var string Start of Line when folding */