Elgg  Version master
Public Member Functions | Protected Attributes | List of all members
Elgg\Request Class Reference

Request container. More...

Public Member Functions

 __construct (protected PublicContainer $dic, protected 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...
 

Protected Attributes

 $validation
 

Detailed Description

Request container.

Definition at line 12 of file Request.php.

Constructor & Destructor Documentation

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

Constructor.

Parameters
PublicContainer$dicDI container
HttpRequest$http_requestRequest

Definition at line 25 of file Request.php.

Member Function Documentation

Elgg\Request::elgg ( )

Get the DI container.

Returns
PublicContainer

Definition at line 125 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 91 of file Request.php.

Elgg\Request::getHttpRequest ( )

Get the HttpRequest for this request.

Returns

Definition at line 166 of file Request.php.

Elgg\Request::getMethod ( )

Get HTTP method of the request.

Returns
string

Definition at line 157 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 67 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 53 of file Request.php.

Elgg\Request::getPath ( )

Get relative path of the request.

Returns
string

Definition at line 141 of file Request.php.

Elgg\Request::getRoute ( )

Get the name of the route.

Returns
string

Definition at line 42 of file Request.php.

Elgg\Request::getURL ( )

Get URL of the request.

Returns
string

Definition at line 133 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 107 of file Request.php.

Elgg\Request::isXhr ( )

Is the route access with XmlHttpRequest.

Returns
bool

Definition at line 149 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 80 of file Request.php.

Elgg\Request::validation ( )

Access validation results bag.

Returns
ValidationResults

Definition at line 33 of file Request.php.

Member Data Documentation

Elgg\Request::$validation
protected

Definition at line 17 of file Request.php.


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