Properties

$Parameters

$Parameters : array

Parsed parameters of the calling router.

Type

array

$GetRoutes

$GetRoutes : array

Mapping of routes to their execution functions for GET requests.

Type

array

$PostRoutes

$PostRoutes : array

Mapping of routes to their execution functions for GET requests.

Type

array

$PutRoutes

$PutRoutes : array

Mapping of routes to their execution functions for PUT requests.

Type

array

$DeleteRoutes

$DeleteRoutes : array

Mapping of routes to their execution functions for DELETE requests.

Type

array

$InvalidRouteErrorHandler

$InvalidRouteErrorHandler : array

Method wich handles invalid route error.

Type

array

Methods

__construct()

__construct() 

Singleton �onstructor.

process_one_component_route()

process_one_component_route(  $Object,   $Route) 

Processing one component routes.

Parameters

$Object
$Route

Examples

** File not found : http://example.com/action-name/ **

process_two_component_route()

process_two_component_route(  $Route) 

Processing one component routes.

Parameters

$Route

Examples

** File not found : http://example.com/class-name/action-name/ **

fetch_actions()

fetch_actions(  $Object) 

Method fetches actions from the objects and creates GetRoutes for them.

Parameters

$Object

add_route()

add_route(string  $Route, mixed  $Callback, string  $Request = 'GET') 

Method adds route and it's handler.

$Callback function may have two parameters - $Route and $Parameters. Where $Route is a called route, and $Parameters is associative array (parameter name => parameter value) with URL parameters.

Parameters

string $Route
  • Route.
mixed $Callback
  • Collback wich will be processing route call.
string $Request
  • Request type.

no_processor_found_error_handler()

no_processor_found_error_handler(  $Route) 

Method processes no processor found error.

Parameters

$Route

set_no_processor_found_error_handler()

set_no_processor_found_error_handler(  $Function) 

Method sets InvalidRouteErrorHandler function.

Parameters

$Function

call_route()

call_route(  $Route) 

Processing specified router.

Parameters

$Route

clear()

clear() 

Method clears router data.

get_class_name()

get_class_name(  $RoutePart) 

Transfoming the path of the route in the class name.

Parameters

$RoutePart

prepare_route()

prepare_route(  $Route) 

Method prepares route for the next processing.

Parameters

$Route

get_callable_description()

get_callable_description(  $Processor) 

Method compiles callable description.

Parameters

$Processor

find_static_route_processor()

find_static_route_processor(  $Processors,   $Route) 

Method searches route processor.

Parameters

$Processors
$Route

try_static_routes()

try_static_routes(  $Route) 

Method tries to process static routes without any parameters.

Parameters

$Route

is_parameter()

is_parameter(  $String) 

Method detects if the $String is a parameter or a static component of the route.

Parameters

$String

match_parameter_and_component()

match_parameter_and_component(  $Component,   $Parameter) 

Matching parameter and component.

Parameters

$Component
$Parameter

match_route_and_pattern()

match_route_and_pattern(array  $CleanRoute, array  $CleanPattern) : array

Method matches route and pattern.

Parameters

array $CleanRoute
  • Cleaned route splitted in parts.
array $CleanPattern
  • Route pattern.

Returns

array —

Array of route's parameters.

find_dynamic_route_processor()

find_dynamic_route_processor(  $Processors,   $Route) 

Method searches dynamic route processor.

Parameters

$Processors
$Route

try_dynamic_toutes()

try_dynamic_toutes(  $Route) 

Method tries to process dynamic routes with parameters.

Parameters

$Route

get_all_routes_trace()

get_all_routes_trace() 

Method rturns all available routes.