PHP Class Dietcube\Router

Afficher le fichier Open project: mercari/dietcube Class Usage Examples

Protected Properties

Свойство Type Description
$container
$dispatched_http_method
$dispatched_url
$dispatcher FastRoute\Dispatcher\GroupCountBased
$named_routes
$route_info
$routes dietcube\RouteInterface[]

Méthodes publiques

Méthode Description
__construct ( Pimple\Container $container )
addRoute ( dietcube\RouteInterface $route )
dispatch ( string $http_method, string $url ) : array URL からディスパッチ対象を取得する
getDispatchedMethod ( )
getDispatchedUrl ( )
getRouteInfo ( )
init ( )
url ( string $handler, array $data = [], array $query_params = [], boolean $is_absolute = false ) : string Generate URL from route name (handler name).

Méthodes protégées

Méthode Description
buildNameIndex ( )

Method Details

__construct() public méthode

public __construct ( Pimple\Container $container )
$container Pimple\Container

addRoute() public méthode

public addRoute ( dietcube\RouteInterface $route )
$route dietcube\RouteInterface

buildNameIndex() protected méthode

protected buildNameIndex ( )

dispatch() public méthode

URL からディスパッチ対象を取得する
public dispatch ( string $http_method, string $url ) : array
$http_method string
$url string
Résultat array

getDispatchedMethod() public méthode

public getDispatchedMethod ( )

getDispatchedUrl() public méthode

public getDispatchedUrl ( )

getRouteInfo() public méthode

public getRouteInfo ( )

init() public méthode

public init ( )

url() public méthode

This methods is inspired by Slim3's Router.
See also: https://github.com/slimphp/Slim/blob/3494b3625ec51c2de90d9d893767d97f876e49ff/Slim/Router.php#L162
public url ( string $handler, array $data = [], array $query_params = [], boolean $is_absolute = false ) : string
$handler string Route handler name
$data array Route URI segments replacement data
$query_params array Optional query string parameters
$is_absolute boolean Whether generate absolute url or not
Résultat string

Property Details

$container protected_oe property

protected $container

$dispatched_http_method protected_oe property

protected $dispatched_http_method

$dispatched_url protected_oe property

protected $dispatched_url

$dispatcher protected_oe property

protected GroupCountBased,FastRoute\Dispatcher $dispatcher
Résultat FastRoute\Dispatcher\GroupCountBased

$named_routes protected_oe property

protected $named_routes

$route_info protected_oe property

protected $route_info

$routes protected_oe property

protected RouteInterface[],dietcube $routes
Résultat dietcube\RouteInterface[]