PHP Class CI_Router, TastyIgniter

Parses URIs and determines routing
Author: EllisLab Dev Team
ファイルを表示 Open project: tastyigniter/tastyigniter Class Usage Examples

Public Properties

Property Type Description
$class string Current class name
$config object CI_Config class object
$default_controller string Default controller (and method if specific)
$directory string Sub-directory that contains the requested controller class
$enable_query_strings boolean Determines whether to use GET parameters or segment URIs
$method string Current method name
$routes array List of routes
$translate_uri_dashes boolean Determines whether dashes in controller & method segments should be automatically replaced by underscores.

Public Methods

Method Description
__construct ( array $routing = NULL ) : void Class constructor
fetch_class ( ) : string Fetch the current class
fetch_directory ( ) : string Fetch directory
fetch_method ( ) : string Fetch the current method
set_class ( string $class ) : void Set class name
set_directory ( string $dir, boolean $append = FALSE ) : void Set directory name
set_method ( string $method ) : void Set method name

Protected Methods

Method Description
_parse_routes ( ) : void Parse Routes
_set_default_controller ( ) : void Set default controller
_set_request ( array $segments = [] ) : void Set request route
_set_routing ( ) : void Set route mapping
_validate_request ( array $segments ) : mixed Validate request

Method Details

__construct() public method

Runs the route mapping function.
public __construct ( array $routing = NULL ) : void
$routing array
return void

_parse_routes() protected method

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.
protected _parse_routes ( ) : void
return void

_set_default_controller() protected method

Set default controller
protected _set_default_controller ( ) : void
return void

_set_request() protected method

Takes an array of URI segments as input and sets the class/method to be called.
protected _set_request ( array $segments = [] ) : void
$segments array URI segments
return void

_set_routing() protected method

Determines what should be served based on the URI request, as well as any "routes" that have been set in the routing config file.
protected _set_routing ( ) : void
return void

_validate_request() protected method

Attempts validate the URI request and determine the controller path.
protected _validate_request ( array $segments ) : mixed
$segments array URI segments
return mixed URI segments

fetch_class() public method

Fetch the current class
Deprecation: 3.0.0 Read the 'class' property instead
public fetch_class ( ) : string
return string

fetch_directory() public method

Feches the sub-directory (if any) that contains the requested controller class.
Deprecation: 3.0.0 Read the 'directory' property instead
public fetch_directory ( ) : string
return string

fetch_method() public method

Fetch the current method
Deprecation: 3.0.0 Read the 'method' property instead
public fetch_method ( ) : string
return string

set_class() public method

Set class name
public set_class ( string $class ) : void
$class string Class name
return void

set_directory() public method

Set directory name
public set_directory ( string $dir, boolean $append = FALSE ) : void
$dir string Directory name
$append boolean Whether we're appending rather than setting the full value
return void

set_method() public method

Set method name
public set_method ( string $method ) : void
$method string Method name
return void

Property Details

$class public_oe property

Current class name
public string $class
return string

$config public_oe property

CI_Config class object
public object $config
return object

$default_controller public_oe property

Default controller (and method if specific)
public string $default_controller
return string

$directory public_oe property

Sub-directory that contains the requested controller class
public string $directory
return string

$enable_query_strings public_oe property

Determines whether to use GET parameters or segment URIs
public bool $enable_query_strings
return boolean

$method public_oe property

Current method name
public string $method
return string

$routes public_oe property

List of routes
public array $routes
return array

$translate_uri_dashes public_oe property

Determines whether dashes in controller & method segments should be automatically replaced by underscores.
public bool $translate_uri_dashes
return boolean