Class Controller_Routing

Description

Handles simple routing rules for dispatching requests to controllers.

This class looks for a file named routes.php in the config folder and will load it to generate the list of configured routes. Within the context of routes.php, the variable $route contains an instance of Controller_Routing_Builder, which can be used to generate routes.

See the documentation for Controller_Routing_Builder for more information.

Located in /controller/lib/Controller/Routing.php (line 17)


	
			
Variable Summary
 mixed $logger
 mixed $routes
Method Summary
 Controller_Routing __construct ()
 void add_legacy_configured_routes ( $builder)
 void add_legacy_default_routes ( $builder)
 void add_route (CriticalI_Routing_Route $route)
 string controller_class (string $name)
 Controller_Base controller_for (string $url, array &$parameters, [string $method = 'get'])
 string controller_name (string $class)
 Controller_Base error_route (int $code, string $message, string $method, array &$parameters)
 Logger logger ()
 string normalize (string $url)
 string url_for (array $parameters, [string $method = 'get'])
Variables
mixed $logger (line 20)
  • access: protected
mixed $routes (line 19)
  • access: protected
Methods
Constructor __construct (line 25)

Constructor

  • access: public
Controller_Routing __construct ()
add_configured_routes (line 199)

Loads configured routing information.

  • access: protected
void add_configured_routes ()
add_legacy_configured_routes (line 256)

Add any route information specified through legacy configuration

properties

  • access: protected
void add_legacy_configured_routes ( $builder)
  • $builder
add_legacy_default_routes (line 271)

Add the default routes that were previously assumed

  • access: protected
void add_legacy_default_routes ( $builder)
  • $builder
add_route (line 101)

Add a route

  • access: public
void add_route (CriticalI_Routing_Route $route)
  • CriticalI_Routing_Route $route: The route to add
controller_class (line 237)

Convert a controller parameter value to a class name

  • access: protected
string controller_class (string $name)
  • string $name: The controller name to convert
controller_for (line 40)

Return the controller for a given URL

  • access: public
Controller_Base controller_for (string $url, array &$parameters, [string $method = 'get'])
  • string $url: The URL to route
  • array &$parameters: Output array for any parameters specified in the URL
  • string $method: The request method
controller_name (line 224)

Convert a class name to a controller parameter value

  • access: protected
string controller_name (string $class)
  • string $class: The class name to convert
error_route (line 117)

Returns the controller to be used for a given error status code. If no controller can be found for the request, it forcibly exits.

  • access: public
Controller_Base error_route (int $code, string $message, string $method, array &$parameters)
  • int $code: The error code
  • string $message: The error message associated with the code
  • string $method: The request method
  • array &$parameters: Output array for any parameters specified in the URL
logger (line 246)

Return this class's logger

  • access: protected
Logger logger ()
normalize (line 156)

Normalize a URL to a request path

  • access: protected
string normalize (string $url)
  • string $url: The URL to normalize
url_for (line 81)

The opposite of controller_for, determines the URL for a given set of parameters. If no URL can be constructed from the parameters, this method throws an exception.

  • access: public
string url_for (array $parameters, [string $method = 'get'])
  • array $parameters: The parameters to generate a URL from
  • string $method: The request method to use

Documentation generated on Wed, 25 Apr 2012 09:46:45 -0700 by phpDocumentor 1.4.3