PHP Class Autarky\Routing\Router

Inheritance: implements Autarky\Routing\RouterInterface
Datei anzeigen Open project: autarky/framework Class Usage Examples

Protected Properties

Property 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

Public Methods

Method 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 = '/' )

Protected Methods

Method 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 method

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 method

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

addBeforeHook() public method

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

addCachedRoute() public method

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

addEventListener() protected method

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

addGlobalAfterHook() public method

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

addGlobalBeforeHook() public method

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

addNamedRoute() protected method

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

addRoute() public method

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

createRoute() protected method

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

dispatch() public method

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

generateDispatchData() protected method

protected generateDispatchData ( )

getContainerParams() protected method

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

getCurrentRoute() public method

public getCurrentRoute ( )

getDispatcher() protected method

protected getDispatcher ( )

getHook() protected method

protected getHook ( $name )

getResponse() protected method

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

getRoute() public method

public getRoute ( $name )

getRouteForRequest() public method

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

getRoutes() public method

public getRoutes ( ) : SplObjectStorage
return SplObjectStorage

group() public method

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

isCaching() public method

public isCaching ( ) : boolean
return boolean

makePath() protected method

protected makePath ( $path )

matchRoute() protected method

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

mount() public method

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

Property Details

$cachePath protected_oe property

protected string|null $cachePath
return string | null

$currentHooks protected_oe property

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

$currentPrefix protected_oe property

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

$currentRoute protected_oe property

protected Route,Autarky\Routing $currentRoute
return Route

$dispatchData protected_oe property

protected mixed $dispatchData
return mixed

$eventDispatcher protected_oe property

protected EventDispatcherInterface,Symfony\Component\EventDispatcher $eventDispatcher
return Symfony\Component\EventDispatcher\EventDispatcherInterface

$hooks protected_oe property

protected array $hooks
return array

$invoker protected_oe property

protected InvokerInterface,Autarky\Routing $invoker
return Autarky\Routing\InvokerInterface

$namedRoutes protected_oe property

protected array $namedRoutes
return array

$routeCollector protected_oe property

protected RouteCollector,FastRoute $routeCollector
return FastRoute\RouteCollector

$routeParser protected_oe property

protected RouteParser,FastRoute $routeParser
return FastRoute\RouteParser

$routes protected_oe property

protected SplObjectStorage $routes
return SplObjectStorage