class Body extends Parameters

Body.

Properties

protected array $parameters Parameters. from Parameters

Methods

__construct(string $rawBody, string $contentType)

Constructor.

int
count()

Returns the numner of items in the collection.

getIterator()

Retruns an array iterator object.

add(string $name, mixed $value)

Adds a parameter.

bool
has(string $name)

Returns true if the parameter exists and false if not.

mixed
get(string $name, mixed $default = null)

Gets a parameter value.

remove(string $name)

Removes a parameter.

array
all()

Returns all the parameters.

array
whitelisted(array $keys, array $defaults = [])

Returns request data where keys not in the whitelist have been removed.

array
blacklisted(array $keys, array $defaults = [])

Returns request data where keys in the blacklist have been removed.

array
parseBody(string $rawBody, string $contentType)

Converts the request body into an associative array.

Details

at line 27
__construct(string $rawBody, string $contentType)

Constructor.

Parameters

string $rawBody Raw request body
string $contentType Content type

in Parameters at line 49
int count()

Returns the numner of items in the collection.

Return Value

int

in Parameters at line 59
ArrayIterator getIterator()

Retruns an array iterator object.

Return Value

ArrayIterator

in Parameters at line 70
add(string $name, mixed $value)

Adds a parameter.

Parameters

string $name Parameter name
mixed $value Parameter value

in Parameters at line 81
bool has(string $name)

Returns true if the parameter exists and false if not.

Parameters

string $name Parameter name

Return Value

bool

in Parameters at line 93
mixed get(string $name, mixed $default = null)

Gets a parameter value.

Parameters

string $name Parameter name
mixed $default Default value

Return Value

mixed

in Parameters at line 103
remove(string $name)

Removes a parameter.

Parameters

string $name Parameter name

in Parameters at line 113
array all()

Returns all the parameters.

Return Value

array

in Parameters at line 125
array whitelisted(array $keys, array $defaults = [])

Returns request data where keys not in the whitelist have been removed.

Parameters

array $keys Keys to whitelist
array $defaults Default values

Return Value

array

in Parameters at line 137
array blacklisted(array $keys, array $defaults = [])

Returns request data where keys in the blacklist have been removed.

Parameters

array $keys Keys to whitelist
array $defaults Default values

Return Value

array

at line 39
protected array parseBody(string $rawBody, string $contentType)

Converts the request body into an associative array.

Parameters

string $rawBody Raw request body
string $contentType Content type

Return Value

array