PHP Class Autarky\Routing\Router

Inheritance: implements Autarky\Routing\RouterInterface
Afficher le fichier Open project: autarky/framework Class Usage Examples

Protected Properties

Свойство Type Description
$cachePath string | null
$currentHooks array The hooks that are currently applied to every route being added.
$currentPrefix string The URL prefix that is currently applied to every route being added.
$currentRoute Route
$dispatchData mixed
$eventDispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface
$hooks array
$invoker Autarky\Routing\InvokerInterface
$namedRoutes array
$routeCollector FastRoute\RouteCollector
$routeParser FastRoute\RouteParser
$routes SplObjectStorage

Méthodes publiques

Méthode Description
__construct ( FastRoute\RouteParser $routeParser, Autarky\Routing\InvokerInterface $invoker, Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher = null, string | null $cachePath = null )
addAfterHook ( string $name, callable $handler, integer $priority ) : void Add an "after" event listener.
addBeforeHook ( string $name, callable $handler, integer $priority ) : void Add a "before" event listener.
addCachedRoute ( Route $route ) Add a cached route.
addGlobalAfterHook ( callable $handler, integer $priority ) : void Add a global "after" event listener.
addGlobalBeforeHook ( callable $handler, integer $priority ) : void Add a global "before" event listener.
addRoute ( $methods, $path, $controller, $name = null, array $options = [] )
dispatch ( Request $request )
getCurrentRoute ( )
getRoute ( $name )
getRouteForRequest ( Request $request ) : Route Get the Route object corresponding to a given request.
getRoutes ( ) : SplObjectStorage
group ( array $flags, Closure $callback )
isCaching ( ) : boolean
mount ( array $routes, $path = '/' )

Méthodes protégées

Méthode Description
addEventListener ( $name, $handler, $when, $priority )
addNamedRoute ( $name, Route $route )
createRoute ( $methods, $path, $controller, $name, array $options )
generateDispatchData ( )
getContainerParams ( Route $route, array $routeParams, Request $request )
getDispatcher ( )
getHook ( $name )
getResponse ( Request $request, Route $route, array $params )
makePath ( $path )
matchRoute ( Route $route, array $params, Request $request )

Method Details

__construct() public méthode

public __construct ( FastRoute\RouteParser $routeParser, Autarky\Routing\InvokerInterface $invoker, Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher = null, string | null $cachePath = null )
$routeParser FastRoute\RouteParser
$invoker Autarky\Routing\InvokerInterface
$eventDispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface
$cachePath string | null

addAfterHook() public méthode

Add an "after" event listener.
public addAfterHook ( string $name, callable $handler, integer $priority ) : void
$name string
$handler callable
$priority integer
Résultat void

addBeforeHook() public méthode

Add a "before" event listener.
public addBeforeHook ( string $name, callable $handler, integer $priority ) : void
$name string
$handler callable
$priority integer
Résultat void

addCachedRoute() public méthode

Add a cached route.
public addCachedRoute ( Route $route )
$route Route

addEventListener() protected méthode

protected addEventListener ( $name, $handler, $when, $priority )

addGlobalAfterHook() public méthode

Add a global "after" event listener.
public addGlobalAfterHook ( callable $handler, integer $priority ) : void
$handler callable
$priority integer
Résultat void

addGlobalBeforeHook() public méthode

Add a global "before" event listener.
public addGlobalBeforeHook ( callable $handler, integer $priority ) : void
$handler callable
$priority integer
Résultat void

addNamedRoute() protected méthode

protected addNamedRoute ( $name, Route $route )
$route Route

addRoute() public méthode

public addRoute ( $methods, $path, $controller, $name = null, array $options = [] )
$options array

createRoute() protected méthode

protected createRoute ( $methods, $path, $controller, $name, array $options )
$options array

dispatch() public méthode

public dispatch ( Request $request )
$request Symfony\Component\HttpFoundation\Request

generateDispatchData() protected méthode

protected generateDispatchData ( )

getContainerParams() protected méthode

protected getContainerParams ( Route $route, array $routeParams, Request $request )
$route Route
$routeParams array
$request Symfony\Component\HttpFoundation\Request

getCurrentRoute() public méthode

public getCurrentRoute ( )

getDispatcher() protected méthode

protected getDispatcher ( )

getHook() protected méthode

protected getHook ( $name )

getResponse() protected méthode

protected getResponse ( Request $request, Route $route, array $params )
$request Symfony\Component\HttpFoundation\Request
$route Route
$params array

getRoute() public méthode

public getRoute ( $name )

getRouteForRequest() public méthode

Get the Route object corresponding to a given request.
public getRouteForRequest ( Request $request ) : Route
$request Symfony\Component\HttpFoundation\Request
Résultat Route

getRoutes() public méthode

public getRoutes ( ) : SplObjectStorage
Résultat SplObjectStorage

group() public méthode

public group ( array $flags, Closure $callback )
$flags array
$callback Closure

isCaching() public méthode

public isCaching ( ) : boolean
Résultat boolean

makePath() protected méthode

protected makePath ( $path )

matchRoute() protected méthode

protected matchRoute ( Route $route, array $params, Request $request )
$route Route
$params array
$request Symfony\Component\HttpFoundation\Request

mount() public méthode

public mount ( array $routes, $path = '/' )
$routes array

Property Details

$cachePath protected_oe property

protected string|null $cachePath
Résultat string | null

$currentHooks protected_oe property

The hooks that are currently applied to every route being added.
protected array $currentHooks
Résultat array

$currentPrefix protected_oe property

The URL prefix that is currently applied to every route being added.
protected string $currentPrefix
Résultat string

$currentRoute protected_oe property

protected Route,Autarky\Routing $currentRoute
Résultat Route

$dispatchData protected_oe property

protected mixed $dispatchData
Résultat mixed

$eventDispatcher protected_oe property

protected EventDispatcherInterface,Symfony\Component\EventDispatcher $eventDispatcher
Résultat Symfony\Component\EventDispatcher\EventDispatcherInterface

$hooks protected_oe property

protected array $hooks
Résultat array

$invoker protected_oe property

protected InvokerInterface,Autarky\Routing $invoker
Résultat Autarky\Routing\InvokerInterface

$namedRoutes protected_oe property

protected array $namedRoutes
Résultat array

$routeCollector protected_oe property

protected RouteCollector,FastRoute $routeCollector
Résultat FastRoute\RouteCollector

$routeParser protected_oe property

protected RouteParser,FastRoute $routeParser
Résultat FastRoute\RouteParser

$routes protected_oe property

protected SplObjectStorage $routes
Résultat SplObjectStorage