Class Router
A service that parse the URL to request data
- Wei\Base
-
Wei\Router
Namespace: Wei
Author: Twin Huang twinhuang@qq.com
Link:
Located at Router.php
Author: Twin Huang twinhuang@qq.com
Link:
The code is inspired by the awesome framework - Kohana http://kohanaframework.org/3.0/guide/api/Kohana_Route
Located at Router.php
public
|
|
public
array
|
|
public
|
|
public
false|array
|
|
public
|
|
protected
array
|
|
public
false|array
|
|
public
array
|
#
matchParamSet( string $pathInfo, string|null $method = 'GET' )
Parse the path info to parameter set |
protected
false|array
|
#
matchRoute( string $pathInfo, string $method, string $id )
Check if the route matches the path info and method, and return the parameters, or return false when not matched |
public
array
|
#
matchRestParamSet( string $path, string $method = 'GET' )
Parse the path info to multi REST parameters |
protected
array
|
|
public
|
|
public
|
|
protected
string
|
|
protected
string
|
|
protected
string
|
|
protected
boolean
|
__call(),
__construct(),
__get(),
getOption(),
setOption()
|
protected
array
|
$routes
The routes configurations |
#
array()
|
protected
array
|
$routeOptions
The default route options |
#
array(
'pattern' => null,
'rules' => array(),
'defaults' => array(),
'method' => null,
'regex' => null,
)
|
protected
array
|
$namespaces
The string to split out at the beginning of path |
#
array('admin', 'api')
|
protected
array
|
$scopes
The string to split out after namespace string |
#
array('user')
|
protected
array
|
$combinedResources
The resources that contains "/", eg articles/categories, products/categories, issues/comments. |
#
array()
|
protected
string
|
$defaultController
|
#
'index'
|
protected
string
|
$defaultAction
|
#
'index'
|
protected
array
|
$methodToAction
An array contains the HTTP method and action name |
#
array(
'GET-collection' => 'index',
'GET' => 'show',
'POST' => 'create',
'PATCH' => 'update',
'PUT' => 'update',
'DELETE' => 'destroy'
)
|
protected
array
|
$singularRules
Singular inflector rules |
#
array(
'/(o|x|ch|ss|sh)es$/i' => '\1', // heroes, potatoes, tomatoes
'/([^aeiouy]|qu)ies$/i' => '\1y', // histories
'/s$/i' => '',
)
|
protected
array
|
$singulars
The plural to singular array |
#
array(
'aliases' => 'alias',
'analyses' => 'analysis',
'buses' => 'bus',
'children' => 'child',
'cookies' => 'cookie',
'criteria' => 'criterion',
'data' => 'datum',
'lives' => 'life',
'matrices' => 'matrix',
'men' => 'man',
'menus' => 'menu',
'monies' => 'money',
'news' => 'news',
'people' => 'person',
'quizzes' => 'quiz',
)
|
$providers,
$wei
|