Documentation

Header
in package
implements HeaderInterface

Represents a header and all of the values stored by that header

Interfaces, Classes and Traits

HeaderInterface
An object that can be represented as an array

Table of Contents

$glue  : mixed
$header  : mixed
$values  : mixed
__construct()  : mixed
__toString()  : string
Convert the header to a string
add()  : self
Add a value to the list of header values
count()  : mixed
getGlue()  : string
Get the glue used to implode multiple values into a string
getIterator()  : mixed
getName()  : string
Get the name of the header
hasExactHeader()  : mixed
hasValue()  : bool
Check if the collection of headers has a particular value
normalize()  : self
Normalize the header to be a single header with an array of values.
parseParams()  : array<string|int, mixed>
Parse a header containing ";" separated data into an array of associative arrays representing the header key value pair data of the header. When a parameter does not contain a value, but just contains a key, this function will inject a key with a '' string value.
raw()  : mixed
removeValue()  : self
Remove a specific value from the header
setGlue()  : self
Change the glue used to implode the values
setName()  : self
Change the name of the header
toArray()  : mixed
trimHeader()  : string
Trim a header by removing excess spaces and wrapping quotes

Properties

$values

protected mixed $values = array()

Methods

__construct()

public __construct(string $header[, array<string|int, mixed>|string $values = array() ][, string $glue = ',' ]) : mixed
Parameters
$header : string

Name of the header

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

Values of the header as an array or a scalar

$glue : string = ','

Glue used to combine multiple values into a string

Return values
mixed —

__toString()

Convert the header to a string

public __toString() : string
Return values
string —

add()

Add a value to the list of header values

public add(mixed $value) : self
Parameters
$value : mixed

Value to add to the header

Return values
self —

count()

public count() : mixed
Return values
mixed —

getGlue()

Get the glue used to implode multiple values into a string

public getGlue() : string
Return values
string —

getIterator()

public getIterator() : mixed
Return values
mixed —

getName()

Get the name of the header

public getName() : string
Return values
string —

hasExactHeader()

public hasExactHeader(mixed $header) : mixed
Parameters
$header : mixed
Tags
deprecated
codeCoverageIgnore
Return values
mixed —

hasValue()

Check if the collection of headers has a particular value

public hasValue(mixed $searchValue) : bool
Parameters
$searchValue : mixed

Value to search for

Return values
bool —

normalize()

Normalize the header to be a single header with an array of values.

public normalize() : self

If any values of the header contains the glue string value (e.g. ","), then the value will be exploded into multiple entries in the header.

Return values
self —

parseParams()

Parse a header containing ";" separated data into an array of associative arrays representing the header key value pair data of the header. When a parameter does not contain a value, but just contains a key, this function will inject a key with a '' string value.

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

raw()

public raw() : mixed
Tags
deprecated
codeCoverageIgnore
Return values
mixed —

removeValue()

Remove a specific value from the header

public removeValue(mixed $searchValue) : self
Parameters
$searchValue : mixed

Value to remove

Return values
self —

setGlue()

Change the glue used to implode the values

public setGlue(mixed $glue) : self
Parameters
$glue : mixed

Glue used to implode multiple values

Return values
self —

setName()

Change the name of the header

public setName(mixed $name) : self
Parameters
$name : mixed

Name to change to

Return values
self —

toArray()

public toArray() : mixed
Return values
mixed —

trimHeader()

Trim a header by removing excess spaces and wrapping quotes

protected trimHeader( $str) : string
Parameters
$str :
Return values
string —

Search results