PHP Class Dingo\Api\Http\Response\Factory

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

Protected Properties

Свойство Type Description
$transformer Dingo\Api\Transformer\Factory Transformer factory instance.

Méthodes publiques

Méthode Description
__call ( string $method, array $parameters ) : mixed Call magic methods beginning with "with".
__construct ( Dingo\Api\Transformer\Factory $transformer ) : void Create a new response factory instance.
accepted ( null | string $location = null, mixed $content = null ) : Response Respond with an accepted response and associate a location and/or content if provided.
collection ( Collection $collection, object $transformer, array | Closure $parameters = [], Closure $after = null ) : Response Bind a collection to a transformer and start building a response.
created ( null | string $location = null, $content = null ) : Response Respond with a created response and associate a location if provided.
error ( string $message, integer $statusCode ) : void Return an error response.
errorBadRequest ( string $message = 'Bad Request' ) : void Return a 400 bad request error.
errorForbidden ( string $message = 'Forbidden' ) : void Return a 403 forbidden error.
errorInternal ( string $message = 'Internal Error' ) : void Return a 500 internal server error.
errorMethodNotAllowed ( string $message = 'Method Not Allowed' ) : void Return a 405 method not allowed error.
errorNotFound ( string $message = 'Not Found' ) : void Return a 404 not found error.
errorUnauthorized ( string $message = 'Unauthorized' ) : void Return a 401 unauthorized error.
item ( object $item, object $transformer, array $parameters = [], Closure $after = null ) : Response Bind an item to a transformer and start building a response.
noContent ( ) : Response Respond with a no content response.
paginator ( Illuminate\Contracts\Pagination\Paginator $paginator, object $transformer, array $parameters = [], Closure $after = null ) : Response Bind a paginator to a transformer and start building a response.

Method Details

__call() public méthode

Call magic methods beginning with "with".
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
Résultat mixed

__construct() public méthode

Create a new response factory instance.
public __construct ( Dingo\Api\Transformer\Factory $transformer ) : void
$transformer Dingo\Api\Transformer\Factory
Résultat void

accepted() public méthode

Respond with an accepted response and associate a location and/or content if provided.
public accepted ( null | string $location = null, mixed $content = null ) : Response
$location null | string
$content mixed
Résultat Dingo\Api\Http\Response

collection() public méthode

Bind a collection to a transformer and start building a response.
public collection ( Collection $collection, object $transformer, array | Closure $parameters = [], Closure $after = null ) : Response
$collection Illuminate\Support\Collection
$transformer object
$parameters array | Closure
$after Closure
Résultat Dingo\Api\Http\Response

created() public méthode

Respond with a created response and associate a location if provided.
public created ( null | string $location = null, $content = null ) : Response
$location null | string
Résultat Dingo\Api\Http\Response

error() public méthode

Return an error response.
public error ( string $message, integer $statusCode ) : void
$message string
$statusCode integer
Résultat void

errorBadRequest() public méthode

Return a 400 bad request error.
public errorBadRequest ( string $message = 'Bad Request' ) : void
$message string
Résultat void

errorForbidden() public méthode

Return a 403 forbidden error.
public errorForbidden ( string $message = 'Forbidden' ) : void
$message string
Résultat void

errorInternal() public méthode

Return a 500 internal server error.
public errorInternal ( string $message = 'Internal Error' ) : void
$message string
Résultat void

errorMethodNotAllowed() public méthode

Return a 405 method not allowed error.
public errorMethodNotAllowed ( string $message = 'Method Not Allowed' ) : void
$message string
Résultat void

errorNotFound() public méthode

Return a 404 not found error.
public errorNotFound ( string $message = 'Not Found' ) : void
$message string
Résultat void

errorUnauthorized() public méthode

Return a 401 unauthorized error.
public errorUnauthorized ( string $message = 'Unauthorized' ) : void
$message string
Résultat void

item() public méthode

Bind an item to a transformer and start building a response.
public item ( object $item, object $transformer, array $parameters = [], Closure $after = null ) : Response
$item object
$transformer object
$parameters array
$after Closure
Résultat Dingo\Api\Http\Response

noContent() public méthode

Respond with a no content response.
public noContent ( ) : Response
Résultat Dingo\Api\Http\Response

paginator() public méthode

Bind a paginator to a transformer and start building a response.
public paginator ( Illuminate\Contracts\Pagination\Paginator $paginator, object $transformer, array $parameters = [], Closure $after = null ) : Response
$paginator Illuminate\Contracts\Pagination\Paginator
$transformer object
$parameters array
$after Closure
Résultat Dingo\Api\Http\Response

Property Details

$transformer protected_oe property

Transformer factory instance.
protected Factory,Dingo\Api\Transformer $transformer
Résultat Dingo\Api\Transformer\Factory