Router
in package
Router
This class is responsible for parsing the request, matching with possible routes and transferring control to the appropriate controller.
Table of Contents
Properties
- $routes : array<string|int, mixed>
- Routes from config file routes.php
Methods
- __construct() : mixed
- run() : void
- resolveRoute() : void
- This method receives a query string and parses it, if it finds a match in the routes, transfers control to the appropriate controller and its method with query parameters (in the form of an array), if any.
- runController() : void
- Transfer of control to the controller.
Properties
$routes
Routes from config file routes.php
private
array<string|int, mixed>
$routes
= []
Methods
__construct()
public
__construct() : mixed
run()
public
run() : void
resolveRoute()
This method receives a query string and parses it, if it finds a match in the routes, transfers control to the appropriate controller and its method with query parameters (in the form of an array), if any.
private
resolveRoute(string $request_string) : void
Parameters
- $request_string : string
runController()
Transfer of control to the controller.
private
runController(string $controller_name, string $action_name[, array<string|int, mixed> $data = [] ]) : void
Parameters
- $controller_name : string
- $action_name : string
- $data : array<string|int, mixed> = []