Properties

$enableCache

$enableCache : boolean

Type

boolean — 是否开启路由缓存

$routeCache

$routeCache : array

Type

array — 路由缓存

$controllerClassName

$controllerClassName : string

Type

string — 控制器完全命名空间类名

$routePrams

$routePrams : \stdClass

Type

\stdClass — 请求的路由相关信息

Methods

__construct()

__construct() 

NormalRoute constructor.

handleHttpRequest()

handleHttpRequest(\swoole_http_client  $request) 

HTTP请求解析

Parameters

\swoole_http_client $request

请求对象

findControllerClassName()

findControllerClassName() : boolean

计算Controller Class Name

Returns

boolean

parsePath()

parsePath(string  $path) : boolean

解析请求的URL PATH

Parameters

string $path

待解析URL Path

Returns

boolean

parseVerb()

parseVerb(\swoole_http_request  $request) : string

解析请求的方法

Parameters

\swoole_http_request $request

请求对象

Returns

string

getControllerName()

getControllerName() : string

获取控制器名称

Returns

string

getControllerClassName()

getControllerClassName() : string

获取请求对应的控制器完全命名空间类名

Returns

string

getMethodName()

getMethodName() : string

获取方法名称

Returns

string

getPath()

getPath() : string

获取请求的PATH

Returns

string

getIsRpc()

getIsRpc() : boolean

判断请求是否为RPC请求

Returns

boolean

getVerb()

getVerb() : string|null

获取请求的方法

Returns

string|null

getParams()

getParams() : array

获取请求的参数

Returns

array

setControllerName()

setControllerName(string  $name) : $this

设置请求的控制器标识

Parameters

string $name

控制器标识

Returns

$this

setMethodName()

setMethodName(string  $name) : $this

设置请求控制器的方法标识

Parameters

string $name

控制器的方法标识

Returns

$this

setParams()

setParams(array  $params) : $this

设置请求的参数

Parameters

array $params

请求的参数

Returns

$this

getEnableCache()

getEnableCache() : boolean

获取是否支持路由Cache

Returns

boolean

setRouteCache()

setRouteCache(string  $path, array  $callable) : $this

缓存路由

Parameters

string $path

URL Path

array $callable

路由解析结果

Returns

$this

getRouteCache()

getRouteCache(string  $path) : mixed|null

获取已缓存的路由信息

Parameters

string $path

URL Path

Returns

mixed|null