PHP Класс flight\net\Router

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$case_sensitive boolean Case sensitive matching.

Защищенные свойства (Protected)

Свойство Тип Описание
$index integer Pointer to current route.
$routes array Mapped routes.

Открытые методы

Метод Описание
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.

Описание методов

clear() публичный Метод

Clears all routes in the router.
public clear ( )

current() публичный Метод

Gets the current route.
public current ( ) : Route
Результат Route

getRoutes() публичный Метод

Gets mapped routes.
public getRoutes ( ) : array
Результат array Array of routes

map() публичный Метод

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() публичный Метод

Gets the next route.
public next ( ) : Route
Результат Route

reset() публичный Метод

Reset to the first route.
public reset ( )

route() публичный Метод

Routes the current request.
public route ( flight\net\Request $request ) : Route | boolean
$request flight\net\Request Request object
Результат Route | boolean Matching route or false if no match

Описание свойств

$case_sensitive публичное свойство

Case sensitive matching.
public bool $case_sensitive
Результат boolean

$index защищенное свойство

Pointer to current route.
protected int $index
Результат integer

$routes защищенное свойство

Mapped routes.
protected array $routes
Результат array