PHP Class Flugg\Responder\Responder

Author: Alexander Tømmerås ([email protected])
Afficher le fichier Open project: flugger/laravel-responder

Protected Properties

Свойство Type Description
$errorResponse Flugg\Responder\Http\ErrorResponseBuilder The response builder used to build error responses.
$successResponse Flugg\Responder\Http\SuccessResponseBuilder The response builder used to build success responses.

Méthodes publiques

Méthode Description
__construct ( SuccessResponseBuilder $successResponse, ErrorResponseBuilder $errorResponse ) Constructor.
error ( string $errorCode = null, integer $statusCode = null, mixed $message = null ) : Illuminate\Http\JsonResponse Generate an error JSON response.
success ( mixed | null $data = null, integer | null $statusCode = null, array $meta = [] ) : Illuminate\Http\JsonResponse Generate a successful JSON response.
transform ( mixed | null $data = null, callable | string | null $transformer = null ) : SuccessResponseBuilder Transform the data and return a success response builder.

Method Details

__construct() public méthode

Constructor.
public __construct ( SuccessResponseBuilder $successResponse, ErrorResponseBuilder $errorResponse )
$successResponse Flugg\Responder\Http\SuccessResponseBuilder
$errorResponse Flugg\Responder\Http\ErrorResponseBuilder

error() public méthode

Generate an error JSON response.
public error ( string $errorCode = null, integer $statusCode = null, mixed $message = null ) : Illuminate\Http\JsonResponse
$errorCode string
$statusCode integer
$message mixed
Résultat Illuminate\Http\JsonResponse

success() public méthode

Generate a successful JSON response.
public success ( mixed | null $data = null, integer | null $statusCode = null, array $meta = [] ) : Illuminate\Http\JsonResponse
$data mixed | null
$statusCode integer | null
$meta array
Résultat Illuminate\Http\JsonResponse

transform() public méthode

Transform the data and return a success response builder.
public transform ( mixed | null $data = null, callable | string | null $transformer = null ) : SuccessResponseBuilder
$data mixed | null
$transformer callable | string | null
Résultat Flugg\Responder\Http\SuccessResponseBuilder

Property Details

$errorResponse protected_oe property

The response builder used to build error responses.
protected ErrorResponseBuilder,Flugg\Responder\Http $errorResponse
Résultat Flugg\Responder\Http\ErrorResponseBuilder

$successResponse protected_oe property

The response builder used to build success responses.
protected SuccessResponseBuilder,Flugg\Responder\Http $successResponse
Résultat Flugg\Responder\Http\SuccessResponseBuilder