PHP Class API_Route

Author: zsx ([email protected])
Show file Open project: zblogcn/zblogphp Class Usage Examples

Public Properties

Property Type Description
$debug boolean Debug

Public Methods

Method Description
__clone ( ) To avoid clone
get ( string $url, callable $callback ) : boolean Create GET Route
getInstance ( ) : API_Route To return instance
post ( string $url, callable $callback ) : boolean Create POST Route
route ( string $url, callable $callback, string $method = "GLOBAL" ) : boolean Create Route
scanRoute ( string $requestMethod, string $url ) : boolean Scan Route

Private Methods

Method Description
_analyze ( $deep, $array, $tree ) * To analyze path
_checkRegExp ( string $path, array $array ) : boolean Check RegExp
buildCallback ( &$tree, callable $callback ) To build callback to tree
buildRegExpList ( $regex, array &$list, callable $callback ) : boolean To build RegExp list
buildTree ( integer $deep, array $array, array &$tree, $callback ) : boolean To build tree from path
callBack ( array $callbackTree ) To call callable function

Method Details

__clone() public method

To avoid clone
public __clone ( )

get() public static method

Create GET Route
public static get ( string $url, callable $callback ) : boolean
$url string
$callback callable
return boolean

getInstance() public static method

To return instance
public static getInstance ( ) : API_Route
return API_Route

post() public static method

Create POST Route
public static post ( string $url, callable $callback ) : boolean
$url string
$callback callable
return boolean

route() public static method

Create Route
public static route ( string $url, callable $callback, string $method = "GLOBAL" ) : boolean
$url string
$callback callable
$method string
return boolean

scanRoute() public static method

Scan Route
public static scanRoute ( string $requestMethod, string $url ) : boolean
$requestMethod string
$url string
return boolean

Property Details

$debug public static property

Debug
public static bool $debug
return boolean