PHP Class Dingo\Api\Dispatcher

Afficher le fichier Open project: dingo/api Class Usage Examples

Protected Properties

Свойство Type Description
$auth Dingo\Api\Auth\Auth Auth instance.
$container Illuminate\Container\Container Illuminate container instance.
$content string Request raw content.
$cookies array Request cookies.
$defaultDomain string Default domain.
$defaultFormat string Default format.
$defaultVersion string Default version.
$domain string Domain for the request.
$files Illuminate\Filesystem\Filesystem Illuminate filesystem instance.
$headers array Request headers.
$parameters array Request parameters.
$persistAuthentication boolean Indicates whether authentication is persisted.
$prefix string API prefix.
$raw boolean Indicates whether the returned response is the raw response object.
$requestStack array Internal request stack.
$routeStack array Internal route stack.
$router Dingo\Api\Routing\Router Router instance.
$standardsTree string API standards tree.
$subtype string API subtype.
$uploads array Request uploaded files.
$version string Version for the request.

Méthodes publiques

Méthode Description
__construct ( Illuminate\Container\Container $container, Illuminate\Filesystem\Filesystem $files, Router $router, Dingo\Api\Auth\Auth $auth ) : void Create a new dispatcher instance.
attach ( array $files ) : Dispatcher Attach files to be uploaded.
be ( mixed $user ) : Dispatcher Internal request will be authenticated as the given user.
cookie ( Cookie $cookie ) : Dispatcher Set a cookie to be sent on the next API request.
delete ( string $uri, string | array $parameters = [], string $content = '' ) : mixed Perform API DELETE request.
get ( string $uri, string | array $parameters = [] ) : mixed Perform API GET request.
getDomain ( ) : string Get the domain.
getFormat ( ) : string Get the format.
getStandardsTree ( ) : string Get the standards tree.
getSubtype ( ) : string Get the subtype.
getVersion ( ) : string Get the version.
header ( string $key, string $value ) : Dispatcher Set a header to be sent on the next API request.
json ( string | array $content ) : Dispatcher Send a JSON payload in the request body.
on ( string $domain ) : Dispatcher Sets the domain to be used for the request.
once ( ) : Dispatcher Only authenticate with the given user for a single request.
patch ( string $uri, string | array $parameters = [], string $content = '' ) : mixed Perform API PATCH request.
post ( string $uri, string | array $parameters = [], string $content = '' ) : mixed Perform API POST request.
put ( string $uri, string | array $parameters = [], string $content = '' ) : mixed Perform API PUT request.
raw ( ) : Dispatcher Return the raw response object once request is dispatched.
setDefaultDomain ( string $domain ) : void Set the default domain.
setDefaultFormat ( string $format ) : void Set the defult format.
setDefaultVersion ( string $version ) : void Set the default version.
setPrefix ( string $prefix ) : void Set the prefix.
setStandardsTree ( string $standardsTree ) : void Set the standards tree.
setSubtype ( string $subtype ) : void Set the subtype.
version ( string $version ) : Dispatcher Set the version of the API for the next request.
with ( string | array $parameters ) : Dispatcher Set the parameters to be sent on the next API request.

Méthodes protégées

Méthode Description
addPrefixToUri ( string $uri ) : string Add the prefix to the URI.
clearCachedFacadeInstance ( ) : void Clear the cached facade instance.
createRequest ( string $verb, string $uri, string | array $parameters ) : Dingo\Api\Http\InternalRequest Create a new internal request from an HTTP verb and URI.
dispatch ( Dingo\Api\Http\InternalRequest $request ) : mixed Attempt to dispatch an internal request.
getAcceptHeader ( ) : string Build the "Accept" header.
getRootRequest ( ) : Illuminate\Http\Request Get the root request instance.
queueRequest ( string $verb, string $uri, string | array $parameters, string $content = '' ) : mixed Queue up and dispatch a new request.
refreshRequestStack ( ) : void Refresh the request stack.
replaceRequestInstance ( ) : void Replace the request instance with the previous request instance.
setupRequestStack ( ) : void Setup the request stack by grabbing the initial request.

Method Details

__construct() public méthode

Create a new dispatcher instance.
public __construct ( Illuminate\Container\Container $container, Illuminate\Filesystem\Filesystem $files, Router $router, Dingo\Api\Auth\Auth $auth ) : void
$container Illuminate\Container\Container
$files Illuminate\Filesystem\Filesystem
$router Dingo\Api\Routing\Router
$auth Dingo\Api\Auth\Auth
Résultat void

addPrefixToUri() protected méthode

Add the prefix to the URI.
protected addPrefixToUri ( string $uri ) : string
$uri string
Résultat string

attach() public méthode

Attach files to be uploaded.
public attach ( array $files ) : Dispatcher
$files array
Résultat Dispatcher

be() public méthode

Internal request will be authenticated as the given user.
public be ( mixed $user ) : Dispatcher
$user mixed
Résultat Dispatcher

clearCachedFacadeInstance() protected méthode

Clear the cached facade instance.
protected clearCachedFacadeInstance ( ) : void
Résultat void

createRequest() protected méthode

Create a new internal request from an HTTP verb and URI.
protected createRequest ( string $verb, string $uri, string | array $parameters ) : Dingo\Api\Http\InternalRequest
$verb string
$uri string
$parameters string | array
Résultat Dingo\Api\Http\InternalRequest

delete() public méthode

Perform API DELETE request.
public delete ( string $uri, string | array $parameters = [], string $content = '' ) : mixed
$uri string
$parameters string | array
$content string
Résultat mixed

dispatch() protected méthode

Attempt to dispatch an internal request.
protected dispatch ( Dingo\Api\Http\InternalRequest $request ) : mixed
$request Dingo\Api\Http\InternalRequest
Résultat mixed

get() public méthode

Perform API GET request.
public get ( string $uri, string | array $parameters = [] ) : mixed
$uri string
$parameters string | array
Résultat mixed

getAcceptHeader() protected méthode

Build the "Accept" header.
protected getAcceptHeader ( ) : string
Résultat string

getDomain() public méthode

Get the domain.
public getDomain ( ) : string
Résultat string

getFormat() public méthode

Get the format.
public getFormat ( ) : string
Résultat string

getRootRequest() protected méthode

Get the root request instance.
protected getRootRequest ( ) : Illuminate\Http\Request
Résultat Illuminate\Http\Request

getStandardsTree() public méthode

Get the standards tree.
public getStandardsTree ( ) : string
Résultat string

getSubtype() public méthode

Get the subtype.
public getSubtype ( ) : string
Résultat string

getVersion() public méthode

Get the version.
public getVersion ( ) : string
Résultat string

header() public méthode

Set a header to be sent on the next API request.
public header ( string $key, string $value ) : Dispatcher
$key string
$value string
Résultat Dispatcher

json() public méthode

Send a JSON payload in the request body.
public json ( string | array $content ) : Dispatcher
$content string | array
Résultat Dispatcher

on() public méthode

Sets the domain to be used for the request.
public on ( string $domain ) : Dispatcher
$domain string
Résultat Dispatcher

once() public méthode

Only authenticate with the given user for a single request.
public once ( ) : Dispatcher
Résultat Dispatcher

patch() public méthode

Perform API PATCH request.
public patch ( string $uri, string | array $parameters = [], string $content = '' ) : mixed
$uri string
$parameters string | array
$content string
Résultat mixed

post() public méthode

Perform API POST request.
public post ( string $uri, string | array $parameters = [], string $content = '' ) : mixed
$uri string
$parameters string | array
$content string
Résultat mixed

put() public méthode

Perform API PUT request.
public put ( string $uri, string | array $parameters = [], string $content = '' ) : mixed
$uri string
$parameters string | array
$content string
Résultat mixed

queueRequest() protected méthode

Queue up and dispatch a new request.
protected queueRequest ( string $verb, string $uri, string | array $parameters, string $content = '' ) : mixed
$verb string
$uri string
$parameters string | array
$content string
Résultat mixed

raw() public méthode

Return the raw response object once request is dispatched.
public raw ( ) : Dispatcher
Résultat Dispatcher

refreshRequestStack() protected méthode

This is done by resetting the authentication, popping the last request from the stack, replacing the input, and resetting the version and parameters.
protected refreshRequestStack ( ) : void
Résultat void

replaceRequestInstance() protected méthode

Replace the request instance with the previous request instance.
protected replaceRequestInstance ( ) : void
Résultat void

setDefaultDomain() public méthode

Set the default domain.
public setDefaultDomain ( string $domain ) : void
$domain string
Résultat void

setDefaultFormat() public méthode

Set the defult format.
public setDefaultFormat ( string $format ) : void
$format string
Résultat void

setDefaultVersion() public méthode

Set the default version.
public setDefaultVersion ( string $version ) : void
$version string
Résultat void

setPrefix() public méthode

Set the prefix.
public setPrefix ( string $prefix ) : void
$prefix string
Résultat void

setStandardsTree() public méthode

Set the standards tree.
public setStandardsTree ( string $standardsTree ) : void
$standardsTree string
Résultat void

setSubtype() public méthode

Set the subtype.
public setSubtype ( string $subtype ) : void
$subtype string
Résultat void

setupRequestStack() protected méthode

Setup the request stack by grabbing the initial request.
protected setupRequestStack ( ) : void
Résultat void

version() public méthode

Set the version of the API for the next request.
public version ( string $version ) : Dispatcher
$version string
Résultat Dispatcher

with() public méthode

Set the parameters to be sent on the next API request.
public with ( string | array $parameters ) : Dispatcher
$parameters string | array
Résultat Dispatcher

Property Details

$auth protected_oe property

Auth instance.
protected Auth,Dingo\Api\Auth $auth
Résultat Dingo\Api\Auth\Auth

$container protected_oe property

Illuminate container instance.
protected Container,Illuminate\Container $container
Résultat Illuminate\Container\Container

$content protected_oe property

Request raw content.
protected string $content
Résultat string

$cookies protected_oe property

Request cookies.
protected array $cookies
Résultat array

$defaultDomain protected_oe property

Default domain.
protected string $defaultDomain
Résultat string

$defaultFormat protected_oe property

Default format.
protected string $defaultFormat
Résultat string

$defaultVersion protected_oe property

Default version.
protected string $defaultVersion
Résultat string

$domain protected_oe property

Domain for the request.
protected string $domain
Résultat string

$files protected_oe property

Illuminate filesystem instance.
protected Filesystem,Illuminate\Filesystem $files
Résultat Illuminate\Filesystem\Filesystem

$headers protected_oe property

Request headers.
protected array $headers
Résultat array

$parameters protected_oe property

Request parameters.
protected array $parameters
Résultat array

$persistAuthentication protected_oe property

Indicates whether authentication is persisted.
protected bool $persistAuthentication
Résultat boolean

$prefix protected_oe property

API prefix.
protected string $prefix
Résultat string

$raw protected_oe property

Indicates whether the returned response is the raw response object.
protected bool $raw
Résultat boolean

$requestStack protected_oe property

Internal request stack.
protected array $requestStack
Résultat array

$routeStack protected_oe property

Internal route stack.
protected array $routeStack
Résultat array

$router protected_oe property

Router instance.
protected Router,Dingo\Api\Routing $router
Résultat Dingo\Api\Routing\Router

$standardsTree protected_oe property

API standards tree.
protected string $standardsTree
Résultat string

$subtype protected_oe property

API subtype.
protected string $subtype
Résultat string

$uploads protected_oe property

Request uploaded files.
protected array $uploads
Résultat array

$version protected_oe property

Version for the request.
protected string $version
Résultat string