class Params implements ArrayAccess (View source)

Parse, interpret and compose HTTP (header) parameters.

Constants

DEF_PARAM_SEP

The default parameter separator (",").

DEF_ARG_SEP

The default argument separator (";").

DEF_VAL_SEP

The default value separator ("=").

COOKIE_PARAM_SEP

Empty param separator to parse cookies.

PARSE_RAW

Do not interpret the parsed parameters.

PARSE_DEFAULT

Interpret input as default formatted parameters.

PARSE_ESCAPED

Parse backslash escaped (quoted) strings.

PARSE_URLENCODED

Urldecode single units of parameters, arguments and values.

PARSE_DIMENSION

Parse sub dimensions indicated by square brackets.

PARSE_QUERY

Parse URL querystring (same as http\Params::PARSE_URLENCODED|http\Params::PARSE_DIMENSION).

PARSE_RFC5987

Parse RFC5987 style encoded character set and language information embedded in HTTP header params.

PARSE_RFC5988

Parse RFC5988 (Web Linking) tags of Link headers.

Properties

array $params

The (parsed) parameters.

array $param_sep

The parameter separator(s).

array $arg_sep

The argument separator(s).

array $val_sep

The value separator(s).

int $flags

The modus operandi of the parser. See http\Params::PARSE_* constants.

Methods

__construct(mixed $params = null, mixed $ps = null, mixed $as = null, mixed $vs = null, int $flags = null)

Instantiate a new HTTP (header) parameter set.

string
__toString()

String cast handler. Alias of http\Params::toString().

bool
offsetExists(string $name)

Implements ArrayAccess.

mixed
offsetGet(string $name)

Implements ArrayAccess.

void
offsetSet(string $name, TValue $value)

Implements ArrayAccess.

void
offsetUnset(string $name)

Implements ArrayAccess.

array
toArray()

Convenience method that simply returns http\Params::$params.

string
toString()

Returns a stringified version of the parameters.

Details

__construct(mixed $params = null, mixed $ps = null, mixed $as = null, mixed $vs = null, int $flags = null)

Instantiate a new HTTP (header) parameter set.

Parameters

mixed $params

Pre-parsed parameters or a string to be parsed.

mixed $ps

The parameter separator(s).

mixed $as

The argument separator(s).

mixed $vs

The value separator(s).

int $flags

The modus operandi. See http\Params::PARSE_* constants.

Exceptions

InvalidArgumentException
RuntimeException

string __toString()

String cast handler. Alias of http\Params::toString().

Returns a stringified version of the parameters.

Return Value

string

version of the parameters.

bool offsetExists(string $name)

Implements ArrayAccess.

Parameters

string $name

The offset to look after.

Return Value

bool

true on success or false on failure.

The return value will be casted to boolean if non-boolean was returned.

mixed offsetGet(string $name)

Implements ArrayAccess.

Parameters

string $name

The offset to retrieve.

Return Value

mixed

Can return all value types.

void offsetSet(string $name, TValue $value)

Implements ArrayAccess.

Parameters

string $name

The offset to modify.

TValue $value

The value to set.

Return Value

void

void offsetUnset(string $name)

Implements ArrayAccess.

Parameters

string $name

The offset to delete.

Return Value

void

array toArray()

Convenience method that simply returns http\Params::$params.

Return Value

array

of parameters.

string toString()

Returns a stringified version of the parameters.

Return Value

string

version of the parameters.