Elgg  Version 3.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Elgg\Router Class Reference

Public Member Functions

 __construct (PluginHooksService $hooks, RouteCollection $routes, UrlMatcher $matcher, HandlersService $handlers, ResponseFactory $response)
 Constructor. More...
 
 route (HttpRequest $request)
 Routes the request to a registered page handler. More...
 
 getResponse (HttpRequest $request)
 Build a response. More...
 
 allowRewrite (HttpRequest $request)
 Filter a request through the route:rewrite hook. More...
 

Protected Member Functions

 prepareLegacyResponse (HttpRequest $request)
 Prepare legacy response by listening to "route" hook. More...
 
 prepareResponse (HttpRequest $request)
 Prepare response. More...
 
 getResponseFromHandler ($handler,\Elgg\Request $request)
 Get response from handler function. More...
 
 getResponseFromFile ($file,\Elgg\Request $request)
 Get response from file. More...
 

Protected Attributes

 $hooks
 
 $routes
 
 $matcher
 
 $handlers
 
 $response
 

Detailed Description

Definition at line 26 of file Router.php.

Constructor & Destructor Documentation

Elgg\Router::__construct ( PluginHooksService  $hooks,
RouteCollection  $routes,
UrlMatcher  $matcher,
HandlersService  $handlers,
ResponseFactory  $response 
)

Constructor.

Parameters
PluginHooksService$hooksHook service
RouteCollection$routesRoute collection
UrlMatcher$matcherURL Matcher
HandlersService$handlersHandlers service
ResponseFactory$responseResponse

Definition at line 64 of file Router.php.

Member Function Documentation

Elgg\Router::allowRewrite ( HttpRequest  $request)

Filter a request through the route:rewrite hook.

Parameters
\Elgg\Http\Request$requestElgg request
Returns

Definition at line 346 of file Router.php.

Elgg\Router::getResponse ( HttpRequest  $request)

Build a response.

Parameters
\Elgg\Http\Request$requestRequest
Returns
ResponseBuilder
Exceptions
Exception
PageNotFoundException

Definition at line 117 of file Router.php.

Elgg\Router::getResponseFromFile (   $file,
\Elgg\Request  $request 
)
protected

Get response from file.

Parameters
string$fileFile
\Elgg\Request$requestRequest envelope
Returns
ResponseBuilder|null
Exceptions
PageNotFoundException

Definition at line 315 of file Router.php.

Elgg\Router::getResponseFromHandler (   $handler,
\Elgg\Request  $request 
)
protected

Get response from handler function.

Parameters
callable$handlerLegacy page handler function
\Elgg\Request$requestRequest envelope
Returns
ResponseBuilder|null
Exceptions
Exception

Definition at line 277 of file Router.php.

Elgg\Router::prepareLegacyResponse ( HttpRequest  $request)
protected

Prepare legacy response by listening to "route" hook.

Parameters
\Elgg\Http\Request$requestRequest
Returns
ResponseBuilder|null
Exceptions
Exception

Definition at line 145 of file Router.php.

Elgg\Router::prepareResponse ( HttpRequest  $request)
protected

Prepare response.

Parameters
\Elgg\Http\Request$requestRequest
Returns
ResponseBuilder|null
Exceptions
Exception
PageNotFoundException

Definition at line 210 of file Router.php.

Elgg\Router::route ( HttpRequest  $request)

Routes the request to a registered page handler.

This function triggers a plugin hook `'route', $identifier` so that plugins can modify the routing or handle a request.

Parameters
\Elgg\Http\Request$requestThe request to handle.
Returns
boolean Whether the request was routed successfully.
Exceptions
InvalidParameterException
Exception

Definition at line 90 of file Router.php.

Member Data Documentation

Elgg\Router::$handlers
protected

Definition at line 48 of file Router.php.

Elgg\Router::$hooks
protected

Definition at line 33 of file Router.php.

Elgg\Router::$matcher
protected

Definition at line 43 of file Router.php.

Elgg\Router::$response
protected

Definition at line 53 of file Router.php.

Elgg\Router::$routes
protected

Definition at line 38 of file Router.php.


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