\CI_Router

Router Class

Parses URIs and determines routing

Summary

Methods
Properties
Constants
__construct()
_set_routing()
_set_default_controller()
_set_request()
_validate_request()
_parse_routes()
set_class()
fetch_class()
set_method()
fetch_method()
set_directory()
fetch_directory()
_set_overrides()
$config
$routes
$error_routes
$class
$method
$directory
$default_controller
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$config

$config : object

Config class

Type

object

$routes

$routes : array

List of routes

Type

array

$error_routes

$error_routes : array

List of error routes

Type

array

$class

$class : string

Current class name

Type

string

$method

$method : string

Current method name

Type

string

$directory

$directory : string

Sub-directory that contains the requested controller class

Type

string

$default_controller

$default_controller : string

Default controller (and method if specific)

Type

string

Methods

__construct()

__construct() 

Constructor

Runs the route mapping function.

_set_routing()

_set_routing() : void

Set the route mapping

This function determines what should be served based on the URI request, as well as any "routes" that have been set in the routing config file.

_set_default_controller()

_set_default_controller() : void

Set the default controller

_set_request()

_set_request(  $segments = array()) : void

Set the Route

This function takes an array of URI segments as input, and sets the current class/method

Parameters

$segments

_validate_request()

_validate_request(  $segments) : array

Validates the supplied segments. Attempts to determine the path to the controller.

Parameters

$segments

Returns

array

_parse_routes()

_parse_routes() : void

Parse Routes

This function matches any routes that may exist in the config/routes.php file against the URI to determine if the class/method need to be remapped.

set_class()

set_class(  $class) : void

Set the class name

Parameters

$class

fetch_class()

fetch_class() : string

Fetch the current class

Returns

string

set_method()

set_method(  $method) : void

Set the method name

Parameters

$method

fetch_method()

fetch_method() : string

Fetch the current method

Returns

string

set_directory()

set_directory(  $dir) : void

Set the directory name

Parameters

$dir

fetch_directory()

fetch_directory() : string

Fetch the sub-directory (if any) that contains the requested controller class

Returns

string

_set_overrides()

_set_overrides(  $routing) : null

Set the controller overrides

Parameters

$routing

Returns

null