Constants

NORMALIZE_NONE

NORMALIZE_NONE

Normalization option

Don't normalize

NORMALIZE_TRIM

NORMALIZE_TRIM

Normalization option

Normalize the outer whitespace of the header

NORMALIZE_DELIMITERS

NORMALIZE_DELIMITERS

Normalization option

Normalize the delimiters of the header

NORMALIZE_CASE

NORMALIZE_CASE

Normalization option

Normalize the case of the header

NORMALIZE_CANONICAL

NORMALIZE_CANONICAL

Normalization option

Normalize the header into canonical format

NORMALIZE_ALL

NORMALIZE_ALL

Normalization option

Normalize using all normalization techniques

Properties

$attributes

$attributes : 

Collection of data attributes

Type

$normalization

$normalization : 

The header key normalization technique/style to use when accessing headers in the collection

Type

Methods

__construct()

__construct(array  $headers = array(), integer  $normalization = self::NORMALIZE_ALL) 

Constructor

Parameters

array $headers

The headers of this collection

integer $normalization

The header key normalization technique/style to use

keys()

keys(array  $mask = null, boolean  $fill_with_nulls = true) : array

Returns all of the key names in the collection

If an optional mask array is passed, this only returns the keys that match the mask

Parameters

array $mask

The parameter mask array

boolean $fill_with_nulls

Whether or not to fill the returned array with values to match the given mask, even if they don't exist in the collection

Returns

array

all()

all(array  $mask = null, boolean  $fill_with_nulls = true) : array

Returns all of the attributes in the collection

If an optional mask array is passed, this only returns the keys that match the mask

Parameters

array $mask

The parameter mask array

boolean $fill_with_nulls

Whether or not to fill the returned array with values to match the given mask, even if they don't exist in the collection

Returns

array

get()

get(string  $key, mixed  $default_val = null) : mixed

Get a header

Return a default value if the key doesn't exist

Parameters

string $key

The key of the header to return

mixed $default_val

The default value of the header if it contains no value

Returns

mixed

merge()

merge(array  $attributes = array(), boolean  $hard = false) : \app\framework\Component\Route\Klein\DataCollection\DataCollection

Merge attributes with the collection's attributes

Optionally allows a second boolean parameter to merge the attributes into the collection in a "hard" manner, using the "array_replace" method instead of the usual "array_merge" method

Parameters

array $attributes

The attributes to merge into the collection

boolean $hard

Whether or not to make the merge "hard"

Returns

\app\framework\Component\Route\Klein\DataCollection\DataCollection

exists()

exists(string  $key) : boolean

Check if a header exists

Parameters

string $key

The key of the header

Returns

boolean

remove()

remove(string  $key) : void

Remove a header

Parameters

string $key

The key of the header

isEmpty()

isEmpty() : boolean

Check if the collection is empty

Returns

boolean

__get()

__get(string  $key) : mixed

Magic "__get" method

Allows the ability to arbitrarily request an attribute from this instance while treating it as an instance property

Parameters

string $key

The name of the parameter to return

Returns

mixed

__set()

__set(string  $key, mixed  $value) : void

Magic "__set" method

Allows the ability to arbitrarily set an attribute from this instance while treating it as an instance property

Parameters

string $key

The name of the parameter to set

mixed $value

The value of the parameter to set

__isset()

__isset(string  $key) : boolean

Magic "__isset" method

Allows the ability to arbitrarily check the existence of an attribute from this instance while treating it as an instance property

Parameters

string $key

The name of the parameter

Returns

boolean

__unset()

__unset(string  $key) : void

Magic "__unset" method

Allows the ability to arbitrarily remove an attribute from this instance while treating it as an instance property

Parameters

string $key

The name of the parameter

getIterator()

getIterator() : \ArrayIterator

Get the aggregate iterator

IteratorAggregate interface required method

Returns

\ArrayIterator

offsetGet()

offsetGet(string  $key) : mixed

Get an attribute via array syntax

Allows the access of attributes of this instance while treating it like an array

Parameters

string $key

The name of the parameter to return

Returns

mixed

offsetSet()

offsetSet(string  $key, mixed  $value) : void

Set an attribute via array syntax

Allows the access of attributes of this instance while treating it like an array

Parameters

string $key

The name of the parameter to set

mixed $value

The value of the parameter to set

offsetExists()

offsetExists(string  $key) : boolean

Check existence an attribute via array syntax

Allows the access of attributes of this instance while treating it like an array

Parameters

string $key

The name of the parameter

Returns

boolean

offsetUnset()

offsetUnset(string  $key) : void

Remove an attribute via array syntax

Allows the access of attributes of this instance while treating it like an array

Parameters

string $key

The name of the parameter

count()

count() : integer

Count the attributes via a simple "count" call

Allows the use of the "count" function (or any internal counters) to simply count the number of attributes in the collection.

Returns

integer

getNormalization()

getNormalization() : integer

Get the header key normalization technique/style to use

Returns

integer

normalizeKeyDelimiters()

normalizeKeyDelimiters(string  $key) : string

Normalize a header key's delimiters

This will convert any space or underscore characters to a more standard hyphen (-) character

Parameters

string $key

The ("field") key of the header

Returns

string

canonicalizeKey()

canonicalizeKey(string  $key) : string

Canonicalize a header key

The canonical format is all lower case except for the first letter of "words" separated by a hyphen

Parameters

string $key

The ("field") key of the header

Returns

string

normalizeName()

normalizeName(string  $name, boolean  $make_lowercase = true) : string

Normalize a header name by formatting it in a standard way

This is useful since PHP automatically capitalizes and underscore separates the words of headers

Parameters

string $name

The name ("field") of the header

boolean $make_lowercase

Whether or not to lowercase the name

Returns

string

normalizeKey()

normalizeKey(string  $key) : string

Normalize a header key based on our set normalization style

Parameters

string $key

The ("field") key of the header

Returns

string