\hymie\routerRouter

Summary

Methods
Properties
Constants
__construct()
getController()
No public properties found
DEFAULT_METHOD
getParameterDefaultValue()
getControllerMethodAndParams()
processController()
$infoHolder
N/A
No private methods found
No private properties found
N/A

Constants

DEFAULT_METHOD

DEFAULT_METHOD

默认函数

Properties

Methods

__construct()

__construct(  $modules) 

Parameters

$modules

getController()

getController() : array

根据路由配置获取控制器,控制器方法的 Reflection 实例。

如果找不到控制器则抛出 RouterException,最终会触发 404 页面。

返回的控制器信息数组格式为:

array( 'module' => $module, // 模块名 'controller' => $controller, // 控制器对象 'method' => $reflectMethod, // 方法放射对象 'params' => $paramsArray); // 参数数组

Returns

array

getParameterDefaultValue()

getParameterDefaultValue(\ReflectionParameter  $param) : void

如果 url pathvariable 或者 $_REQUEST 中没有对应的参数,则获取参数默认值,若没有默认值,则设为null

Parameters

\ReflectionParameter $param

getControllerMethodAndParams()

getControllerMethodAndParams(string  $module, string  $controllerName, string  $method, array  $matches) : array

根据路由定义查找控制器,并实例化控制器方法的 Reflection 对象

Parameters

string $module

模块名

string $controllerName

控制器名

string $method

方法名

array $matches

匹配的参数

Returns

array

processController()

processController(string|array  $controllerDef) : array

处理控制器配置,获得控制器名称、方法名

Parameters

string|array $controllerDef

Returns

array