Elgg  Version 5.1
Public Member Functions | List of all members
Elgg\Request Class Reference

Request container. More...

Public Member Functions

 __construct (PublicContainer $dic, HttpRequest $http_request)
 Constructor. More...
 
 validation ()
 Access validation results bag. More...
 
 getRoute ()
 Get the name of the route. More...
 
 getParams ($filter=true)
 Get the parameters from the request query and route matches. More...
 
 getParam ($key, $default=null, $filter=true)
 Get an element of the params array. More...
 
 setParam ($key, $value=null)
 Set request parameter. More...
 
 getEntityParam (string $key= 'guid')
 Gets the "entity" key from the params if it holds an Elgg entity. More...
 
 getUserParam (string $key= 'user_guid')
 Gets the "user" key from the params if it holds an Elgg user. More...
 
 elgg ()
 Get the DI container. More...
 
 getURL ()
 Get URL of the request. More...
 
 getPath ()
 Get relative path of the request. More...
 
 isXhr ()
 Is the route access with XmlHttpRequest. More...
 
 getMethod ()
 Get HTTP method of the request. More...
 
 getHttpRequest ()
 Get the HttpRequest for this request. More...
 

Detailed Description

Request container.

Definition at line 12 of file Request.php.

Constructor & Destructor Documentation

Elgg\Request::__construct ( PublicContainer  $dic,
HttpRequest  $http_request 
)

Constructor.

Parameters
PublicContainer$dicDI container
HttpRequest$http_requestRequest

Definition at line 35 of file Request.php.

Member Function Documentation

Elgg\Request::elgg ( )

Get the DI container.

Returns
PublicContainer

Definition at line 137 of file Request.php.

Elgg\Request::getEntityParam ( string  $key = 'guid')

Gets the "entity" key from the params if it holds an Elgg entity.

Parameters
string$keyInput key to pull entity GUID from
Returns
|null

Definition at line 103 of file Request.php.

Elgg\Request::getHttpRequest ( )

Get the HttpRequest for this request.

Returns

Definition at line 178 of file Request.php.

Elgg\Request::getMethod ( )

Get HTTP method of the request.

Returns
string

Definition at line 169 of file Request.php.

Elgg\Request::getParam (   $key,
  $default = null,
  $filter = true 
)

Get an element of the params array.

If the params array is not an array, the default will always be returned.

Parameters
string$keyThe key of the value in the params array
mixed$defaultThe value to return if missing
bool$filterSanitize input value
Returns
mixed

Definition at line 79 of file Request.php.

Elgg\Request::getParams (   $filter = true)

Get the parameters from the request query and route matches.

Parameters
bool$filterSanitize input values
Returns
array

Definition at line 65 of file Request.php.

Elgg\Request::getPath ( )

Get relative path of the request.

Returns
string

Definition at line 153 of file Request.php.

Elgg\Request::getRoute ( )

Get the name of the route.

Returns
string

Definition at line 54 of file Request.php.

Elgg\Request::getURL ( )

Get URL of the request.

Returns
string

Definition at line 145 of file Request.php.

Elgg\Request::getUserParam ( string  $key = 'user_guid')

Gets the "user" key from the params if it holds an Elgg user.

Parameters
string$keyInput key to pull user GUID from, or "username" for a username.
Returns
|null

Definition at line 119 of file Request.php.

Elgg\Request::isXhr ( )

Is the route access with XmlHttpRequest.

Returns
bool

Definition at line 161 of file Request.php.

Elgg\Request::setParam (   $key,
  $value = null 
)

Set request parameter.

See also
set_input()
Parameters
string$keyParameter name
mixed$valueValue
Returns
void

Definition at line 92 of file Request.php.

Elgg\Request::validation ( )

Access validation results bag.

Returns
ValidationResults

Definition at line 45 of file Request.php.


The documentation for this class was generated from the following file: