\Guzzle\Http\MessageHeader

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

Summary

Methods
Properties
Constants
__construct()
__toString()
add()
getName()
setName()
setGlue()
getGlue()
normalize()
hasValue()
removeValue()
toArray()
count()
getIterator()
parseParams()
hasExactHeader()
raw()
No public properties found
No constants found
trimHeader()
$values
$header
$glue
N/A
No private methods found
No private properties found
N/A

Properties

$values

$values : 

Type

$header

$header : 

Type

$glue

$glue : 

Type

Methods

__construct()

__construct(string  $header, array|string  $values = array(), string  $glue = ',') 

Parameters

string $header

Name of the header

array|string $values

Values of the header as an array or a scalar

string $glue

Glue used to combine multiple values into a string

__toString()

__toString() : string

Convert the header to a string

Returns

string

add()

add(string  $value) : self

Add a value to the list of header values

Parameters

string $value

Value to add to the header

Returns

self

getName()

getName() : string

Get the name of the header

Returns

string

setName()

setName(string  $name) : self

Change the name of the header

Parameters

string $name

Name to change to

Returns

self

setGlue()

setGlue(string  $glue) : self

Change the glue used to implode the values

Parameters

string $glue

Glue used to implode multiple values

Returns

self

getGlue()

getGlue() : string

Get the glue used to implode multiple values into a string

Returns

string

normalize()

normalize() : self

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

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.

Returns

self

hasValue()

hasValue(string  $searchValue) : boolean

Check if the collection of headers has a particular value

Parameters

string $searchValue

Value to search for

Returns

boolean

removeValue()

removeValue(string  $searchValue) : self

Remove a specific value from the header

Parameters

string $searchValue

Value to remove

Returns

self

toArray()

toArray() 

count()

count() 

getIterator()

getIterator() 

parseParams()

parseParams() : array

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.

Returns

array

hasExactHeader()

hasExactHeader(  $header) 

Parameters

$header

raw()

raw() 

trimHeader()

trimHeader(  $str) : string

Trim a header by removing excess spaces and wrapping quotes

Parameters

$str

Returns

string