Documentation

Put extends AccessBase
in package

A class that provides helpers for accessing PUT OR PATCH form data

Table of Contents

$super  : array<, mixed>
$which  : int
__construct()  : mixed
Constructor
exists()  : bool
Is the key in the array?
fetch()  : mixed
Look in the array for a key and return its trimmed value or a default value
fetchAll()  : ArrayIterator
Return an ArrayIterator over all the values in the form
fetchArray()  : ArrayIterator
Look in the array for a key that is an array and return an ArrayIterator over it
fetchRaw()  : array<, mixed>
Return the array of values
mustExist()  : bool
Is the key in the array?
mustFetch()  : mixed
Look in the array for a key and return its trimmed value
mustFetchArray()  : ArrayIterator
Look in the array for a key that is an array and return an ArrayIterator over it
mustFetchBean()  : OODBBean
Look in the array for a key that is an id for a bean
getSuper()  : array<, mixed>
Return the relevant Superglobal
parse()  : array<, mixed>
Parses the form data and extract the fields
parseHeaders()  : array<, mixed>
Parses body param headers

Properties

$super

protected array<, mixed> $super

The array that contains the relevant values. It is protected rather than private as some items do not have Superglobals and set this value to an array;

$which

protected int $which

Indicates which Superglobal we are using

Methods

__construct()

Constructor

public __construct() : mixed
Return values
mixed

exists()

Is the key in the array?

public exists(mixed $name) : bool
Parameters
$name : mixed

The keys

Tags
TODO

Fix the need for two calls. They are there because getval does an array check which is not relevant for an existence check. We need a three valued boolean :-)

Return values
bool

fetch()

Look in the array for a key and return its trimmed value or a default value

public fetch( $name[, mixed $default = '' ][, int|null $filter = NULL ][, mixed $options = [] ][, bool $isArray = FALSE ]) : mixed

N.B. This function assumes the value is a string and will fail if used on array values

Parameters
$name :

The key or if it is an array then the key and the fields that are needed XXX['xyz'][0]

$default : mixed = ''

Returned if the key does not exist

$filter : int|null = NULL

Filter to apply

$options : mixed = []

Filter options

$isArray : bool = FALSE

If TRUE then expect an array rather than a simple value

Return values
mixed

fetchAll()

Return an ArrayIterator over all the values in the form

public fetchAll() : ArrayIterator
Return values
ArrayIterator

fetchArray()

Look in the array for a key that is an array and return an ArrayIterator over it

public fetchArray(mixed $name[, array<, mixed> $default = [] ]) : ArrayIterator
Parameters
$name : mixed

The key

$default : array<, mixed> = []
Return values
ArrayIterator

fetchRaw()

Return the array of values

public fetchRaw() : array<, mixed>
Return values
array<, mixed>

mustExist()

Is the key in the array?

public mustExist(mixed $name) : bool
Parameters
$name : mixed

The keys

Tags
TODO

Fix the need for two calls. They are there because getval does an array check which is not relevant for an existence check. We need a three valued boolean :-)

throws
BadValue
Return values
bool

mustFetch()

Look in the array for a key and return its trimmed value

public mustFetch( $name[, int|null $filter = NULL ][,  $options = [] ][, bool $isArray = FALSE ]) : mixed

N.B. This function assumes the value is a string and will fail if used on array values

Parameters
$name :

The key or if it is an array then the key and the fields that are needed $_GET['xyz'][0]

$filter : int|null = NULL

Filter to apply

$options : = []

Filter options

$isArray : bool = FALSE

Expect an array ratherthan a simple value

Return values
mixed

mustFetchArray()

Look in the array for a key that is an array and return an ArrayIterator over it

public mustFetchArray(mixed $name) : ArrayIterator
Parameters
$name : mixed

The key or if it is an array then the key and the fields that are needed XXX['xyz'][0]

Tags
throws
BadValue
Return values
ArrayIterator

mustFetchBean()

Look in the array for a key that is an id for a bean

public mustFetchBean(mixed $name, string $bean[, bool $forupdate = FALSE ]) : OODBBean

N.B. This function assumes the value is a string and will fail if used on array values

Parameters
$name : mixed

The key or if it is an array then the key and the fields that are needed XXX['xyz'][0]

$bean : string

The bean type

$forupdate : bool = FALSE

If TRUE then load for update

Return values
OODBBean

getSuper()

Return the relevant Superglobal

protected getSuper([int $which = NULL ]) : array<, mixed>

@TODO Change this to use match() when PHP 8 is released

Parameters
$which : int = NULL

@return array

Return values
array<, mixed>

parse()

Parses the form data and extract the fields

private parse() : array<, mixed>
Return values
array<, mixed>

parseHeaders()

Parses body param headers

private parseHeaders(string $data) : array<, mixed>
Parameters
$data : string

The header data

Return values
array<, mixed>

Search results