PHP 클래스 Dingo\Api\Routing\Router

파일 보기 프로젝트 열기: dingo/api 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$accept Dingo\Api\Http\Parser\Accept Accept parser instance.
$adapter Dingo\Api\Contract\Routing\Adapter Routing adapter instance.
$conditionalRequest boolean Indicates if the request is conditional.
$container Illuminate\Container\Container Application container instance.
$currentRoute Route The current route being dispatched.
$domain string The API domain.
$exception Dingo\Api\Contract\Debug\ExceptionHandler Exception handler instance.
$groupStack array Group stack array.
$prefix string The API prefix.
$routesDispatched integer The number of routes dispatched.

공개 메소드들

메소드 설명
__construct ( Dingo\Api\Contract\Routing\Adapter $adapter, Dingo\Api\Contract\Debug\ExceptionHandler $exception, Illuminate\Container\Container $container, string $domain, string $prefix ) : void Create a new router instance.
addRoute ( string | array $methods, string $uri, string | array | callable $action ) : mixed Add a route to the routing adapter.
any ( string $uri, array | string | callable $action ) : mixed Create a new route that responding to all verbs.
createRoute ( array | Illuminate\Routing\Route $route ) : Route Create a new route instance from an adapter route.
current ( ) : Illuminate\Routing\Route Get the currently dispatched route instance.
currentRouteAction ( ) : string | null Get the current route action.
currentRouteName ( ) : string | null Get the current route name.
currentRouteNamed ( string $name ) : boolean Determine if the current route matches a given name.
currentRouteUses ( string $action ) : boolean Determine if the current route action matches a given action.
delete ( string $uri, array | string | callable $action ) : mixed Create a new DELETE route.
dispatch ( Dingo\Api\Http\Request $request ) : Response Dispatch a request via the adapter.
gatherRouteMiddlewares ( mixed $route ) : array Gather the middleware for the given route.
get ( string $uri, array | string | callable $action ) : mixed Create a new GET route.
getAdapterRoutes ( ) : array Get the raw adapter routes.
getCurrentRequest ( ) : Dingo\Api\Http\Request Get the current request instance.
getCurrentRoute ( ) : Route Get the current route instance.
getLastGroupPrefix ( ) : string Get the prefix from the last group on the stack.
getRoutes ( string $version = null ) : mixed Get all routes registered on the adapter.
getRoutesDispatched ( ) : integer Get the number of routes dispatched.
group ( array $attributes, callable $callback ) : void Create a new route group.
hasDispatchedRoutes ( ) : boolean Determine if the router has dispatched any routes.
hasGroupStack ( ) : boolean Determine if the router has a group stack.
is ( ) : boolean Alias for the "currentRouteNamed" method.
match ( array | string $methods, string $uri, array | string | callable $action ) : mixed Create a new route with the given verbs.
options ( string $uri, array | string | callable $action ) : mixed Create a new OPTIONS route.
patch ( string $uri, array | string | callable $action ) : mixed Create a new PATCH route.
post ( string $uri, array | string | callable $action ) : mixed Create a new POST route.
put ( string $uri, array | string | callable $action ) : mixed Create a new PUT route.
resource ( string $name, string $controller, array $options = [] ) : void Register a resource controller.
resources ( array $resources ) : void Register an array of resources.
setAdapterRoutes ( array $routes ) : void Set the raw adapter routes.
setConditionalRequest ( boolean $conditionalRequest ) : void Set the conditional request.
setCurrentRoute ( Route $route ) : void Set the current route instance.
uses ( ) : boolean Alias for the "currentRouteUses" method.
version ( string $version, array | callable $second, callable $third = null ) : void An alias for calling the group method, allows a more fluent API for registering a new API version group with optional attributes and a required callback.

보호된 메소드들

메소드 설명
addControllerMiddlewareToRouteAction ( array $action ) : array Add the controller preparation middleware to the beginning of the routes middleware.
formatArrayBasedOption ( string $option, array $new ) : array Format an array based option in a route action.
formatNamespace ( array $new, array $old ) : string Format the namespace for the new group attributes.
formatPrefix ( array $new, array $old ) : string Format the prefix for the new group attributes.
formatUses ( array $new, array $old ) : string Format the uses key in a route action.
mergeGroup ( array $new, array $old ) : array Merge the given group attributes.
mergeLastGroupAttributes ( array $attributes ) : array Merge the last groups attributes.
prepareResponse ( mixed $response, Dingo\Api\Http\Request $request, string $format ) : Response Prepare a response by transforming and formatting it correctly.
requestIsConditional ( ) : boolean Determine if the request is conditional.

메소드 상세

__construct() 공개 메소드

Create a new router instance.
public __construct ( Dingo\Api\Contract\Routing\Adapter $adapter, Dingo\Api\Contract\Debug\ExceptionHandler $exception, Illuminate\Container\Container $container, string $domain, string $prefix ) : void
$adapter Dingo\Api\Contract\Routing\Adapter
$exception Dingo\Api\Contract\Debug\ExceptionHandler
$container Illuminate\Container\Container
$domain string
$prefix string
리턴 void

addControllerMiddlewareToRouteAction() 보호된 메소드

Add the controller preparation middleware to the beginning of the routes middleware.
protected addControllerMiddlewareToRouteAction ( array $action ) : array
$action array
리턴 array

addRoute() 공개 메소드

Add a route to the routing adapter.
public addRoute ( string | array $methods, string $uri, string | array | callable $action ) : mixed
$methods string | array
$uri string
$action string | array | callable
리턴 mixed

any() 공개 메소드

Create a new route that responding to all verbs.
public any ( string $uri, array | string | callable $action ) : mixed
$uri string
$action array | string | callable
리턴 mixed

createRoute() 공개 메소드

Create a new route instance from an adapter route.
public createRoute ( array | Illuminate\Routing\Route $route ) : Route
$route array | Illuminate\Routing\Route
리턴 Route

current() 공개 메소드

Get the currently dispatched route instance.
public current ( ) : Illuminate\Routing\Route
리턴 Illuminate\Routing\Route

currentRouteAction() 공개 메소드

Get the current route action.
public currentRouteAction ( ) : string | null
리턴 string | null

currentRouteName() 공개 메소드

Get the current route name.
public currentRouteName ( ) : string | null
리턴 string | null

currentRouteNamed() 공개 메소드

Determine if the current route matches a given name.
public currentRouteNamed ( string $name ) : boolean
$name string
리턴 boolean

currentRouteUses() 공개 메소드

Determine if the current route action matches a given action.
public currentRouteUses ( string $action ) : boolean
$action string
리턴 boolean

delete() 공개 메소드

Create a new DELETE route.
public delete ( string $uri, array | string | callable $action ) : mixed
$uri string
$action array | string | callable
리턴 mixed

dispatch() 공개 메소드

Dispatch a request via the adapter.
public dispatch ( Dingo\Api\Http\Request $request ) : Response
$request Dingo\Api\Http\Request
리턴 Dingo\Api\Http\Response

formatArrayBasedOption() 보호된 메소드

Format an array based option in a route action.
protected formatArrayBasedOption ( string $option, array $new ) : array
$option string
$new array
리턴 array

formatNamespace() 보호된 메소드

Format the namespace for the new group attributes.
protected formatNamespace ( array $new, array $old ) : string
$new array
$old array
리턴 string

formatPrefix() 보호된 메소드

Format the prefix for the new group attributes.
protected formatPrefix ( array $new, array $old ) : string
$new array
$old array
리턴 string

formatUses() 보호된 메소드

Format the uses key in a route action.
protected formatUses ( array $new, array $old ) : string
$new array
$old array
리턴 string

gatherRouteMiddlewares() 공개 메소드

Gather the middleware for the given route.
public gatherRouteMiddlewares ( mixed $route ) : array
$route mixed
리턴 array

get() 공개 메소드

Create a new GET route.
public get ( string $uri, array | string | callable $action ) : mixed
$uri string
$action array | string | callable
리턴 mixed

getAdapterRoutes() 공개 메소드

Get the raw adapter routes.
public getAdapterRoutes ( ) : array
리턴 array

getCurrentRequest() 공개 메소드

Get the current request instance.
public getCurrentRequest ( ) : Dingo\Api\Http\Request
리턴 Dingo\Api\Http\Request

getCurrentRoute() 공개 메소드

Get the current route instance.
public getCurrentRoute ( ) : Route
리턴 Route

getLastGroupPrefix() 공개 메소드

Get the prefix from the last group on the stack.
public getLastGroupPrefix ( ) : string
리턴 string

getRoutes() 공개 메소드

Get all routes registered on the adapter.
public getRoutes ( string $version = null ) : mixed
$version string
리턴 mixed

getRoutesDispatched() 공개 메소드

Get the number of routes dispatched.
public getRoutesDispatched ( ) : integer
리턴 integer

group() 공개 메소드

Create a new route group.
public group ( array $attributes, callable $callback ) : void
$attributes array
$callback callable
리턴 void

hasDispatchedRoutes() 공개 메소드

Determine if the router has dispatched any routes.
public hasDispatchedRoutes ( ) : boolean
리턴 boolean

hasGroupStack() 공개 메소드

Determine if the router has a group stack.
public hasGroupStack ( ) : boolean
리턴 boolean

is() 공개 메소드

Alias for the "currentRouteNamed" method.
public is ( ) : boolean
리턴 boolean

match() 공개 메소드

Create a new route with the given verbs.
public match ( array | string $methods, string $uri, array | string | callable $action ) : mixed
$methods array | string
$uri string
$action array | string | callable
리턴 mixed

mergeGroup() 보호된 메소드

Merge the given group attributes.
protected mergeGroup ( array $new, array $old ) : array
$new array
$old array
리턴 array

mergeLastGroupAttributes() 보호된 메소드

Merge the last groups attributes.
protected mergeLastGroupAttributes ( array $attributes ) : array
$attributes array
리턴 array

options() 공개 메소드

Create a new OPTIONS route.
public options ( string $uri, array | string | callable $action ) : mixed
$uri string
$action array | string | callable
리턴 mixed

patch() 공개 메소드

Create a new PATCH route.
public patch ( string $uri, array | string | callable $action ) : mixed
$uri string
$action array | string | callable
리턴 mixed

post() 공개 메소드

Create a new POST route.
public post ( string $uri, array | string | callable $action ) : mixed
$uri string
$action array | string | callable
리턴 mixed

prepareResponse() 보호된 메소드

Prepare a response by transforming and formatting it correctly.
protected prepareResponse ( mixed $response, Dingo\Api\Http\Request $request, string $format ) : Response
$response mixed
$request Dingo\Api\Http\Request
$format string
리턴 Dingo\Api\Http\Response

put() 공개 메소드

Create a new PUT route.
public put ( string $uri, array | string | callable $action ) : mixed
$uri string
$action array | string | callable
리턴 mixed

requestIsConditional() 보호된 메소드

Determine if the request is conditional.
protected requestIsConditional ( ) : boolean
리턴 boolean

resource() 공개 메소드

Register a resource controller.
public resource ( string $name, string $controller, array $options = [] ) : void
$name string
$controller string
$options array
리턴 void

resources() 공개 메소드

Register an array of resources.
public resources ( array $resources ) : void
$resources array
리턴 void

setAdapterRoutes() 공개 메소드

Set the raw adapter routes.
public setAdapterRoutes ( array $routes ) : void
$routes array
리턴 void

setConditionalRequest() 공개 메소드

Set the conditional request.
public setConditionalRequest ( boolean $conditionalRequest ) : void
$conditionalRequest boolean
리턴 void

setCurrentRoute() 공개 메소드

Set the current route instance.
public setCurrentRoute ( Route $route ) : void
$route Route
리턴 void

uses() 공개 메소드

Alias for the "currentRouteUses" method.
public uses ( ) : boolean
리턴 boolean

version() 공개 메소드

This method can be called without the third parameter, however, the callback should always be the last paramter.
public version ( string $version, array | callable $second, callable $third = null ) : void
$version string
$second array | callable
$third callable
리턴 void

프로퍼티 상세

$accept 보호되어 있는 프로퍼티

Accept parser instance.
protected Accept,Dingo\Api\Http\Parser $accept
리턴 Dingo\Api\Http\Parser\Accept

$adapter 보호되어 있는 프로퍼티

Routing adapter instance.
protected Adapter,Dingo\Api\Contract\Routing $adapter
리턴 Dingo\Api\Contract\Routing\Adapter

$conditionalRequest 보호되어 있는 프로퍼티

Indicates if the request is conditional.
protected bool $conditionalRequest
리턴 boolean

$container 보호되어 있는 프로퍼티

Application container instance.
protected Container,Illuminate\Container $container
리턴 Illuminate\Container\Container

$currentRoute 보호되어 있는 프로퍼티

The current route being dispatched.
protected Route,Dingo\Api\Routing $currentRoute
리턴 Route

$domain 보호되어 있는 프로퍼티

The API domain.
protected string $domain
리턴 string

$exception 보호되어 있는 프로퍼티

Exception handler instance.
protected ExceptionHandler,Dingo\Api\Contract\Debug $exception
리턴 Dingo\Api\Contract\Debug\ExceptionHandler

$groupStack 보호되어 있는 프로퍼티

Group stack array.
protected array $groupStack
리턴 array

$prefix 보호되어 있는 프로퍼티

The API prefix.
protected string $prefix
리턴 string

$routesDispatched 보호되어 있는 프로퍼티

The number of routes dispatched.
protected int $routesDispatched
리턴 integer