PHP Class Ergo\Http\HeaderCollection

Inheritance: implements IteratorAggregate
Show file Open project: 99designs/ergo Class Usage Examples

Public Methods

Method Description
__construct ( $headers = [] ) Constructor
add ( $header ) Adds a header to the collection, either in "Header: Value" format or an {@link HeaderField} object.
getIterator ( ) * (non-phpdoc)
remove ( $header ) Remove a header by name
replace ( $header ) Replaces a header in the collection, either in "Header: Value" format or an {@link HeaderField} object.
toArray ( $crlf = true ) : array Returns an array of the string versions of headers
value ( $name, $default = false ) : string Gets a single header value
values ( $name ) : array Gets an array of the values for a header

Method Details

__construct() public method

Constructor
public __construct ( $headers = [] )
$headers HeaderField[]

add() public method

Adds a header to the collection, either in "Header: Value" format or an {@link HeaderField} object.
public add ( $header )

getIterator() public method

* (non-phpdoc)
See also: IteratorAggregate::getIterator
public getIterator ( )

remove() public method

Remove a header by name
public remove ( $header )

replace() public method

Replaces a header in the collection, either in "Header: Value" format or an {@link HeaderField} object.
public replace ( $header )

toArray() public method

Returns an array of the string versions of headers
public toArray ( $crlf = true ) : array
return array

value() public method

Gets a single header value
public value ( $name, $default = false ) : string
return string

values() public method

Gets an array of the values for a header
public values ( $name ) : array
return array