Router
in package
Router for a Lumos application.
Table of Contents
Properties
- $app : Application
- The application instance.
- $namedRoutes : array<string|int, mixed>
- All of the named routes and URI pairs.
- $groupStack : array<string|int, mixed>
- The route group attribute stack.
- $routes : array<string|int, mixed>
- All of the routes waiting to be registered.
Methods
- __construct() : mixed
- Router constructor.
- addRoute() : void
- Add a route to the collection.
- delete() : $this
- Register a route with the application.
- get() : $this
- Register a route with the application.
- getRoutes() : array<string|int, mixed>
- Get the raw routes for the application.
- group() : void
- Register a set of routes with a set of shared attributes.
- hasGroupStack() : bool
- Determine if the router currently has a group stack.
- mergeGroup() : array<string|int, mixed>
- Merge the given group attributes.
- patch() : $this
- Register a route with the application.
- post() : $this
- Register a route with the application.
- put() : $this
- Register a route with the application.
- formatGroupPrefix() : string|null
- Format the prefix for the new group attributes.
- formatUsesPrefix() : string|null
- Format the uses prefix for the new group attributes.
- mergeAsGroup() : array<string|int, mixed>
- Merge the as group into the action.
- mergeGroupAttributes() : array<string|int, mixed>
- Merge the group attributes into the action.
- mergeMiddlewareGroup() : array<string|int, mixed>
- Merge the middleware group into the action.
- mergeNamespaceGroup() : array<string|int, mixed>
- Merge the namespace group into the action.
- mergeWithLastGroup() : array<string|int, mixed>
- Merge the given group attributes with the last added group.
- parseAction() : array<string|int, mixed>
- Parse the action into an array format.
- prependGroupNamespace() : string
- Prepend the namespace onto the use clause.
- updateGroupStack() : void
- Update the group stack with the given attributes.
Properties
$app
The application instance.
public
Application
$app
$namedRoutes
All of the named routes and URI pairs.
public
array<string|int, mixed>
$namedRoutes
= []
$groupStack
The route group attribute stack.
protected
array<string|int, mixed>
$groupStack
= []
$routes
All of the routes waiting to be registered.
protected
array<string|int, mixed>
$routes
= []
Methods
__construct()
Router constructor.
public
__construct(Application $app) : mixed
Parameters
- $app : Application
addRoute()
Add a route to the collection.
public
addRoute(array<string|int, mixed>|string $method, string $uri, mixed $action) : void
Parameters
- $method : array<string|int, mixed>|string
- $uri : string
- $action : mixed
delete()
Register a route with the application.
public
delete(string $uri, mixed $action) : $this
Parameters
- $uri : string
- $action : mixed
Return values
$thisget()
Register a route with the application.
public
get(string $uri, mixed $action) : $this
Parameters
- $uri : string
- $action : mixed
Return values
$thisgetRoutes()
Get the raw routes for the application.
public
getRoutes() : array<string|int, mixed>
Return values
array<string|int, mixed>group()
Register a set of routes with a set of shared attributes.
public
group(array<string|int, mixed> $attributes, Closure $callback) : void
Parameters
- $attributes : array<string|int, mixed>
- $callback : Closure
hasGroupStack()
Determine if the router currently has a group stack.
public
hasGroupStack() : bool
Return values
boolmergeGroup()
Merge the given group attributes.
public
mergeGroup(array<string|int, mixed> $new, array<string|int, mixed> $old) : array<string|int, mixed>
Parameters
- $new : array<string|int, mixed>
- $old : array<string|int, mixed>
Return values
array<string|int, mixed>patch()
Register a route with the application.
public
patch(string $uri, mixed $action) : $this
Parameters
- $uri : string
- $action : mixed
Return values
$thispost()
Register a route with the application.
public
post(string $uri, mixed $action) : $this
Parameters
- $uri : string
- $action : mixed
Return values
$thisput()
Register a route with the application.
public
put(string $uri, mixed $action) : $this
Parameters
- $uri : string
- $action : mixed
Return values
$thisformatGroupPrefix()
Format the prefix for the new group attributes.
protected
formatGroupPrefix(array<string|int, mixed> $new, array<string|int, mixed> $old) : string|null
Parameters
- $new : array<string|int, mixed>
- $old : array<string|int, mixed>
Return values
string|nullformatUsesPrefix()
Format the uses prefix for the new group attributes.
protected
formatUsesPrefix(array<string|int, mixed> $new, array<string|int, mixed> $old) : string|null
Parameters
- $new : array<string|int, mixed>
- $old : array<string|int, mixed>
Return values
string|nullmergeAsGroup()
Merge the as group into the action.
protected
mergeAsGroup(array<string|int, mixed> $action[, string $as = null ]) : array<string|int, mixed>
Parameters
- $action : array<string|int, mixed>
- $as : string = null
Return values
array<string|int, mixed>mergeGroupAttributes()
Merge the group attributes into the action.
protected
mergeGroupAttributes(array<string|int, mixed> $action, array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
- $action : array<string|int, mixed>
- $attributes : array<string|int, mixed>
Return values
array<string|int, mixed>mergeMiddlewareGroup()
Merge the middleware group into the action.
protected
mergeMiddlewareGroup(array<string|int, mixed> $action[, array<string|int, mixed> $middleware = null ]) : array<string|int, mixed>
Parameters
- $action : array<string|int, mixed>
- $middleware : array<string|int, mixed> = null
Return values
array<string|int, mixed>mergeNamespaceGroup()
Merge the namespace group into the action.
protected
mergeNamespaceGroup(array<string|int, mixed> $action[, string $namespace = null ]) : array<string|int, mixed>
Parameters
- $action : array<string|int, mixed>
- $namespace : string = null
Return values
array<string|int, mixed>mergeWithLastGroup()
Merge the given group attributes with the last added group.
protected
mergeWithLastGroup(array<string|int, mixed> $new) : array<string|int, mixed>
Parameters
- $new : array<string|int, mixed>
Return values
array<string|int, mixed>parseAction()
Parse the action into an array format.
protected
parseAction(mixed $action) : array<string|int, mixed>
Parameters
- $action : mixed
Return values
array<string|int, mixed>prependGroupNamespace()
Prepend the namespace onto the use clause.
protected
prependGroupNamespace(string $class[, string $namespace = null ]) : string
Parameters
- $class : string
- $namespace : string = null
Return values
stringupdateGroupStack()
Update the group stack with the given attributes.
protected
updateGroupStack(array<string|int, mixed> $attributes) : void
Parameters
- $attributes : array<string|int, mixed>