PHP Class Dingo\Api\Http\Response\Factory

Datei anzeigen Open project: dingo/api Class Usage Examples

Protected Properties

Property Type Description
$transformer Dingo\Api\Transformer\Factory Transformer factory instance.

Public Methods

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

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

__construct() public method

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

accepted() public method

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
return Dingo\Api\Http\Response

collection() public method

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
return Dingo\Api\Http\Response

created() public method

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

error() public method

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

errorBadRequest() public method

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

errorForbidden() public method

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

errorInternal() public method

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

errorMethodNotAllowed() public method

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

errorNotFound() public method

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

errorUnauthorized() public method

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

item() public method

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
return Dingo\Api\Http\Response

noContent() public method

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

paginator() public method

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
return Dingo\Api\Http\Response

Property Details

$transformer protected_oe property

Transformer factory instance.
protected Factory,Dingo\Api\Transformer $transformer
return Dingo\Api\Transformer\Factory