ApiResponseTrait
Table of Contents
-
$responseCreator
: ResponseCreator
-
setResponseCreator()
: mixed
-
errorResponse()
: JsonResponse
-
exceptionResponse()
: JsonResponse
-
successResponse()
: JsonResponse
setResponseCreator()
public
setResponseCreator(ResponseCreator $responseCreator) : mixed
Parameters
-
$responseCreator
: ResponseCreator
-
-
required
-
Return values
mixed
—
errorResponse()
protected
errorResponse([mixed $data = ['content' => 'error'] ][, int $code = Response::HTTP_UNPROCESSABLE_ENTITY ]) : JsonResponse
Parameters
-
$data
: mixed
= ['content' => 'error']
-
-
$code
: int
= Response::HTTP_UNPROCESSABLE_ENTITY
-
Return values
JsonResponse
—
exceptionResponse()
protected
exceptionResponse(Exception $exception) : JsonResponse
Parameters
-
$exception
: Exception
-
Return values
JsonResponse
—
successResponse()
protected
successResponse([array<string|int, mixed> $data = ['content' => ResponseCreator::RESPONSE_SUCCESS] ][, int $code = Response::HTTP_OK ]) : JsonResponse
Parameters
-
$data
: array<string|int, mixed>
= ['content' => ResponseCreator::RESPONSE_SUCCESS]
-
-
$code
: int
= Response::HTTP_OK
-
Return values
JsonResponse
—