Elgg  Version 3.0
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 ($key= 'guid')
 Gets the "entity" key from the params if it holds an Elgg entity. More...
 
 getUserParam ($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...
 

Detailed Description

Request container.

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

Member Function Documentation

Elgg\Request::elgg ( )

Get the DI container.

Returns
PublicContainer

Definition at line 146 of file Request.php.

Elgg\Request::getEntityParam (   $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 104 of file Request.php.

Elgg\Request::getMethod ( )

Get HTTP method of the request.

Returns
string

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

Elgg\Request::getPath ( )

Get relative path of the request.

Returns
string

Definition at line 162 of file Request.php.

Elgg\Request::getRoute ( )

Get the name of the route.

Returns
string

Definition at line 55 of file Request.php.

Elgg\Request::getURL ( )

Get URL of the request.

Returns
string

Definition at line 154 of file Request.php.

Elgg\Request::getUserParam (   $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 123 of file Request.php.

Elgg\Request::isXhr ( )

Is the route access with XmlHttpRequest.

Returns
bool

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

Elgg\Request::validation ( )

Access validation results bag.

Returns
ValidationResults

Definition at line 46 of file Request.php.


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