PHP Class flight\net\Router

Datei anzeigen Open project: mikecao/flight Class Usage Examples

Public Properties

Property Type Description
$case_sensitive boolean Case sensitive matching.

Protected Properties

Property Type Description
$index integer Pointer to current route.
$routes array Mapped routes.

Public Methods

Method Description
clear ( ) Clears all routes in the router.
current ( ) : Route Gets the current route.
getRoutes ( ) : array Gets mapped routes.
map ( string $pattern, callback $callback, boolean $pass_route = false ) Maps a URL pattern to a callback function.
next ( ) : Route Gets the next route.
reset ( ) Reset to the first route.
route ( flight\net\Request $request ) : Route | boolean Routes the current request.

Method Details

clear() public method

Clears all routes in the router.
public clear ( )

current() public method

Gets the current route.
public current ( ) : Route
return Route

getRoutes() public method

Gets mapped routes.
public getRoutes ( ) : array
return array Array of routes

map() public method

Maps a URL pattern to a callback function.
public map ( string $pattern, callback $callback, boolean $pass_route = false )
$pattern string URL pattern to match
$callback callback Callback function
$pass_route boolean Pass the matching route object to the callback

next() public method

Gets the next route.
public next ( ) : Route
return Route

reset() public method

Reset to the first route.
public reset ( )

route() public method

Routes the current request.
public route ( flight\net\Request $request ) : Route | boolean
$request flight\net\Request Request object
return Route | boolean Matching route or false if no match

Property Details

$case_sensitive public_oe property

Case sensitive matching.
public bool $case_sensitive
return boolean

$index protected_oe property

Pointer to current route.
protected int $index
return integer

$routes protected_oe property

Mapped routes.
protected array $routes
return array