Documentation

Horde_Mime_Headers
in package
implements ArrayAccess, IteratorAggregate, Serializable

This class represents the collection of header values for a single mail message part.

It supports the base e-mail spec (RFC 5322) and the MIME extensions to that spec (RFC 2045).

Tags
author

Michael Slusarz slusarz@horde.org

category

Horde

copyright

2002-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Interfaces, Classes, Traits and Enums

ArrayAccess
IteratorAggregate
Serializable

Table of Contents

VALUE_BASE  = 2
VALUE_PARAMS  = 3
VALUE_STRING  = 1
VERSION  = 3
$defaultCharset  : string
The default charset to use when parsing text parts with no charset information.
$_eol  : mixed
$_handlers  : array<string|int, mixed>
Cached handler information for Header Element objects.
$_headers  : Horde_Support_CaseInsensitiveArray
The internal headers array.
__call()  : mixed
Handle deprecated methods.
__callStatic()  : mixed
Handle deprecated static methods.
__clone()  : mixed
__construct()  : mixed
Constructor.
__serialize()  : array<string|int, mixed>
Serialization.
__unserialize()  : void
Unserialization.
addHeader()  : mixed
Add/append/replace a header.
addHeaderOb()  : mixed
Add a Horde_Mime_Headers_Element object to the current header list.
getEOL()  : mixed
getHeader()  : Horde_Mime_Headers_Element
Get a header from the header array.
getIterator()  : mixed
offsetExists()  : bool
Does header exist?
offsetGet()  : Horde_Mime_Headers_Element
Return header element object.
offsetSet()  : mixed
Store a header element object.
offsetUnset()  : mixed
Remove a header element object.
parseHeaders()  : Horde_Mime_Headers
Builds a Horde_Mime_Headers object from header text.
removeHeader()  : mixed
Remove a header from the header array.
serialize()  : string
Serialization.
setEOL()  : mixed
toArray()  : array<string|int, mixed>
Returns the headers in array format.
toString()  : string
Returns all headers concatenated into a single string.
unserialize()  : mixed
Unserialization.
_getHeaderClassName()  : string
Return the header class to use for a header name.

Constants

VALUE_BASE

public mixed VALUE_BASE = 2

VALUE_PARAMS

public mixed VALUE_PARAMS = 3

VALUE_STRING

public mixed VALUE_STRING = 1

Properties

$defaultCharset

The default charset to use when parsing text parts with no charset information.

public static string $defaultCharset = 'us-ascii'
Tags
todo

Make this a non-static property or pass as parameter to static methods in Horde 6.

$_eol

protected mixed $_eol = "\n"
Tags
deprecated

$_handlers

Cached handler information for Header Element objects.

protected static array<string|int, mixed> $_handlers = array()

$_headers

The internal headers array.

protected Horde_Support_CaseInsensitiveArray $_headers

Methods

__call()

Handle deprecated methods.

public __call(mixed $name, mixed $arguments) : mixed
Parameters
$name : mixed
$arguments : mixed
Return values
mixed

__callStatic()

Handle deprecated static methods.

public static __callStatic(mixed $name, mixed $arguments) : mixed
Parameters
$name : mixed
$arguments : mixed
Return values
mixed

__clone()

public __clone() : mixed
Return values
mixed

__construct()

Constructor.

public __construct() : mixed
Return values
mixed

__serialize()

Serialization.

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

Serialized data.

__unserialize()

Unserialization.

public __unserialize(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

Serialized data.

Tags
throws
Horde_Mime_Exception
Return values
void

addHeader()

Add/append/replace a header.

public addHeader(string $header, string $value[, array<string|int, mixed> $opts = array() ]) : mixed
Parameters
$header : string

The header name.

$value : string

The header value (UTF-8).

$opts : array<string|int, mixed> = array()

DEPRECATED

Return values
mixed

addHeaderOb()

Add a Horde_Mime_Headers_Element object to the current header list.

public addHeaderOb(Horde_Mime_Headers_Element $ob[, bool $check = false ]) : mixed
Parameters
$ob : Horde_Mime_Headers_Element

Header object to add.

$check : bool = false

Check that the header and object type match?

Tags
since
2.5.0
throws
InvalidArgumentException
Return values
mixed

getEOL()

public getEOL() : mixed
Tags
deprecated
Return values
mixed

getIterator()

public getIterator() : mixed
Tags
since
2.5.0
Return values
mixed

offsetExists()

Does header exist?

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Tags
since
2.5.0
Return values
bool

True if header exists.

offsetSet()

Store a header element object.

public offsetSet(string $offset, mixed $value) : mixed
Parameters
$offset : string

Not used.

$value : mixed
Tags
since
2.5.0
Return values
mixed

offsetUnset()

Remove a header element object.

public offsetUnset(string $offset) : mixed
Parameters
$offset : string

Header name.

Tags
since
2.5.0
Return values
mixed

parseHeaders()

Builds a Horde_Mime_Headers object from header text.

public static parseHeaders(mixed $text) : Horde_Mime_Headers
Parameters
$text : mixed

A text string (or, as of 2.3.0, a Horde_Stream object or stream resource) containing the headers.

Return values
Horde_Mime_Headers

A new Horde_Mime_Headers object.

removeHeader()

Remove a header from the header array.

public removeHeader(string $header) : mixed
Parameters
$header : string

The header name.

Return values
mixed

serialize()

Serialization.

public serialize() : string
Return values
string

Serialized data.

setEOL()

public setEOL(mixed $eol) : mixed
Parameters
$eol : mixed
Tags
deprecated
Return values
mixed

toArray()

Returns the headers in array format.

public toArray([array<string|int, mixed> $opts = array() ]) : array<string|int, mixed>
Parameters
$opts : array<string|int, mixed> = array()

Optional parameters:

  - broken_rfc2231: (boolean) Attempt to work around non-RFC
                    2231-compliant MUAs by generating both a RFC
                    2047-like parameter name and also the correct RFC
                    2231 parameter
                    DEFAULT: false
  - canonical: (boolean) Use canonical (RFC 822/2045) CRLF EOLs?
               DEFAULT: Uses "\n"
  - charset: (string) Encodes the headers using this charset. If empty,
             encodes using UTF-8.
             DEFAULT: No encoding.
  - defserver: (string) The default domain to append to mailboxes.
               DEFAULT: No default name.
  - lang: (string) The language to use when encoding.
          DEFAULT: None specified
  - nowrap: (integer) Don't wrap the headers.
            DEFAULT: Headers are wrapped.
Return values
array<string|int, mixed>

The headers in array format. Keys are header names, but case sensitivity cannot be guaranteed. Values are header values.

toString()

Returns all headers concatenated into a single string.

public toString([array<string|int, mixed> $opts = array() ]) : string
Parameters
$opts : array<string|int, mixed> = array()

See toArray().

Return values
string

The headers in string format.

unserialize()

Unserialization.

public unserialize(string $data) : mixed
Parameters
$data : string

Serialized data.

Tags
throws
Exception
Return values
mixed

_getHeaderClassName()

Return the header class to use for a header name.

protected _getHeaderClassName(string $header) : string
Parameters
$header : string

The header name.

Return values
string

The Horde_Mime_Headers_* class to use.

Search results