MailMimeParser 1.1

HeaderContainer implements IteratorAggregate

Maintains a collection of headers for a part.

Tags
author

Zaahid Bateson

Interfaces, Classes and Traits

IteratorAggregate

Table of Contents

$headerFactory  : HeaderFactory
$headerMap  : array<string|int, mixed>
$headerObjects  : array<string|int, AbstractHeader>
$headers  : array<string|int, array<string|int, string>>
$nextIndex  : int
__construct()  : mixed
Constructor
add()  : mixed
Adds the header to the collection.
exists()  : bool
Returns true if the passed header exists in this collection.
get()  : AbstractHeader
Returns the AbstractHeader object for the header with the given $name and at the optional offset (defaulting to the first header in the collection where more than one header with the same name exists).
getAll()  : array<string|int, AbstractHeader>
Returns all headers with the passed name.
getHeaderObjects()  : AbstractHeader
Returns an array of AbstractHeader objects representing all headers in this collection.
getHeaders()  : array<string|int, array<string|int, string>>
Returns an array of headers in this collection. Each returned element in the array is an array with the first element set to the name, and the second its value:
getIterator()  : ArrayIterator
Returns an iterator to the headers in this collection. Each returned element is an array with its first element set to the header's name, and the second to its value:
remove()  : bool
Removes the header from the collection with the passed name. Defaults to removing the first instance of the header for a collection that contains more than one with the same passed name.
removeAll()  : bool
Removes all headers that match the passed name.
set()  : mixed
If a header exists with the passed name, and at the passed offset if more than one exists, its value is updated.
getByIndex()  : AbstractHeader
Returns the header in the headers array at the passed 0-based integer index.
getNormalizedHeaderName()  : string
Returns the string in lower-case, and with non-alphanumeric characters stripped out.

Properties

$headers

private array<string|int, array<string|int, string>> $headers = []

Methods

add()

Adds the header to the collection.

public add(string $name, string $value) : mixed
Parameters
$name : string
$value : string
Return values
mixed

exists()

Returns true if the passed header exists in this collection.

public exists(string $name, int $offset) : bool
Parameters
$name : string
$offset : int
Return values
bool

get()

Returns the AbstractHeader object for the header with the given $name and at the optional offset (defaulting to the first header in the collection where more than one header with the same name exists).

public get(string $name, int $offset) : AbstractHeader

Note that mime headers aren't case sensitive.

Parameters
$name : string
$offset : int
Return values
AbstractHeader

getHeaders()

Returns an array of headers in this collection. Each returned element in the array is an array with the first element set to the name, and the second its value:

public getHeaders() : array<string|int, array<string|int, string>>

[ [ 'Header-Name', 'Header Value' ], [ 'Second-Header-Name', 'Second-Header-Value' ], // etc... ]

Return values
array<string|int, array<string|int, string>>

getIterator()

Returns an iterator to the headers in this collection. Each returned element is an array with its first element set to the header's name, and the second to its value:

public getIterator() : ArrayIterator

[ 'Header-Name', 'Header Value' ]

Return values
ArrayIterator

remove()

Removes the header from the collection with the passed name. Defaults to removing the first instance of the header for a collection that contains more than one with the same passed name.

public remove(string $name, int $offset) : bool
Parameters
$name : string
$offset : int
Return values
bool

removeAll()

Removes all headers that match the passed name.

public removeAll(string $name) : bool
Parameters
$name : string
Return values
bool

set()

If a header exists with the passed name, and at the passed offset if more than one exists, its value is updated.

public set(string $name, string $value, int $offset) : mixed

If a header with the passed name doesn't exist at the passed offset, it is created at the next available offset (offset is ignored when adding).

Parameters
$name : string
$value : string
$offset : int
Return values
mixed

getNormalizedHeaderName()

Returns the string in lower-case, and with non-alphanumeric characters stripped out.

private getNormalizedHeaderName(string $header) : string
Parameters
$header : string
Return values
string

Search results