PHP Class Flugg\Responder\Responder

Author: Alexander Tømmerås ([email protected])
显示文件 Open project: flugger/laravel-responder

Protected Properties

Property 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.

Public Methods

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

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

error() public method

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
return Illuminate\Http\JsonResponse

success() public method

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
return Illuminate\Http\JsonResponse

transform() public method

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
return Flugg\Responder\Http\SuccessResponseBuilder

Property Details

$errorResponse protected_oe property

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

$successResponse protected_oe property

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