Request
Request
Properties
dispatched
protected bool $dispatched
params
protected array $params
public $
method
Request method.
protected string $method
path
The requested path.
private string $path
Methods
__construct
public __construct({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$args | mixed |
__get
Magic method to get the value of a property.
public __get({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$key | string | the name of the property to get |
__unset
Unsets a value from the request object.
public __unset({Array})
This method removes a value from the request object using the specified key.
Parameters
Parameter | Type | Description |
---|---|---|
$key | string | the key of the value to unset |
getPath
Return the request path.
public getPath({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$stripFilename | bool | If true, this will cause the function to return anything before the last '/' |
(including the '/') which is the full directory path name. (Similar to dirname()). |
setPath
Sets the path of the request.
public setPath({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$path | string | the path of the request |
get
Retrieve a request value.
public get({Array})
These values can be sent in a number of ways.
- In a query string. eg: http://youhost.com/controller?key=value
- As form POST data.
- As JSON encoded request body.
Only JSON encoded request bodies support data typing. All other request values will be strings.
Parameters
Parameter | Type | Description |
---|---|---|
$key | string | The data key to retrieve |
$default | mixed | if the value is not set, use this default value |
getInt
Retrieve an integer value from the request.
public getInt({Array})
The most common requests will not provide data typing and data value will always be a string. This method will automatically return the requested value as an integer unless it is NULL or not set. In which case either NULL or the default value will be returned.
Parameters
Parameter | Type | Description |
---|---|---|
$key | string | the key of the request value to return |
$default | int | a default value to use if the value is NULL or not set |
getFloat
Retrieve an float value from the request.
public getFloat({Array})
The most common requests will not provide data typing and data value will always be a string. This method will automatically return the requested value as an float unless it is NULL or not set. In which case either NULL or the default value will be returned.
Parameters
Parameter | Type | Description |
---|---|---|
$key | string | the key of the request value to return |
$default | float | a default value to use if the value is NULL or not set |
getBool
Retrieve an boolean value from the request.
public getBool({Array})
The most common requests will not provide data typing and data value will always be a string. This method will automatically return the requested value as an boolean unless it is NULL or not set. In which case either NULL or the default value will be returned.
This internally uses the boolify() function so the usual bool strings are supported (t, f, true, false, 0, 1, on, off, etc).
Parameters
Parameter | Type | Description |
---|---|---|
$key | string | the key of the request value to return |
$default | NULL | a default value to use if the value is NULL or not set |
has
Check to see if a request value has been set.
public has({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$keys | string | the key of the request value to check for |
$check_any | bool | The check type when $key is an array. TRUE means that ANY key must exist. FALSE means ALL keys must exist. |
set
Set a request value.
public set({Array})
This would not normally be used and has no internal implications on how the application will function as this data is not processed in any way. However setting request data may be useful in your application when reusing/repurposing controller actions so that they may be called from somewhere else in your application.
Parameters
Parameter | Type | Description |
---|---|---|
$key | string | the key value to set |
$value | mixed | the new value |
remove
Removes a parameter from the request.
public remove({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$key | string | the key of the parameter to remove |
getParams
Return an array of request parameters as key/value pairs.
public getParams({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$filter_in | array | only include parameters with keys specified in this filter |
$filter_out | array | exclude parameters with keys specified in this filter |
hasParams
Check if the request has any parameters.
public hasParams({Array})
setParams
Sets the parameters of the request.
public setParams({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$array | array | The array of parameters to set |
count
Returns the number of parameters in the request.
public count({Array})
getMethod
public getMethod({Array})
Returns the method used to initiate this request on the server. .
init
Returns the request as a string.
protected init({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$args | array |
Generated by Hazaar API Doc Generator