SafeParams
class SafeParams
A thin class that manages a collection of SafeParam objects
This class exists rather than having $params directly in Input because a param can itself contain a collection of other params (see SafeParam::TYPE_OBJECT) represented by another SafeParams
Constants
| PARAMLOG_NEVER |
Never log this input parameter (always used for RAW) |
| PARAMLOG_ONLYFULL |
Log the parameter only if details is full |
| PARAMLOG_ALWAYS |
Log the parameter if log details are enabled |
Properties
| private | $params | ||
| private | $logref | ||
| private | $loglevel |
Methods
Returns true if the named parameter exists
Adds the parameter to this object with the given name and value
Takes an array reference for logging fetched parameters
Logs the given $data as $key or sets a sub-log reference if it's a SafeParams
Gets the requested parameter (present and not null)
Same as GetParam() but returns null if the param is not present
Same as GetParam() but returns null if the param is present and null
Same as GetParam() but returns null if the param is not present, or is present and null
Returns a plain associative array of each parameter's name mapped to its raw value
Details
at line 27
bool
HasParam(string $key)
Returns true if the named parameter exists
at line 33
SafeParams
AddParam(string $key, $value)
Adds the parameter to this object with the given name and value
at line 43
SafeParams
SetLogRef(array|null $logref, int $loglevel)
Takes an array reference for logging fetched parameters
at line 47
protected void
LogData(int|null $minlog, int $type, string $key, $data)
Logs the given $data as $key or sets a sub-log reference if it's a SafeParams
at line 78
GetParam(string $key, int $type, int $minlog = self::PARAMLOG_ONLYFULL, array|null $values = null, callable|null $valfunc = null)
Gets the requested parameter (present and not null)
at line 89
GetOptParam(string $key, int $type, int $minlog = self::PARAMLOG_ONLYFULL, array|null $values = null, callable|null $valfunc = null)
Same as GetParam() but returns null if the param is not present
at line 100
GetNullParam(string $key, int $type, int $minlog = self::PARAMLOG_ONLYFULL, array|null $values = null, callable|null $valfunc = null)
Same as GetParam() but returns null if the param is present and null
at line 110
GetOptNullParam(string $key, int $type, int $minlog = self::PARAMLOG_ONLYFULL, array|null $values = null, callable|null $valfunc = null)
Same as GetParam() but returns null if the param is not present, or is present and null
at line 120
array
GetClientObject()
Returns a plain associative array of each parameter's name mapped to its raw value