@@ -19,6 +19,6 @@ |
||
19 | 19 | */ |
20 | 20 | public function __construct() |
21 | 21 | { |
22 | - parent::__construct('Given serializer is not an instance of [' . SerializerAbstract::class . '].'); |
|
22 | + parent::__construct( 'Given serializer is not an instance of [' . SerializerAbstract::class . '].' ); |
|
23 | 23 | } |
24 | 24 | } |
25 | 25 | \ No newline at end of file |
@@ -19,8 +19,8 @@ |
||
19 | 19 | * |
20 | 20 | * @param Model $model |
21 | 21 | */ |
22 | - public function __construct(Model $model) |
|
22 | + public function __construct( Model $model ) |
|
23 | 23 | { |
24 | - parent::__construct('The given transformer does not exist for model [' . get_class($model) . '].'); |
|
24 | + parent::__construct( 'The given transformer does not exist for model [' . get_class( $model ) . '].' ); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | \ No newline at end of file |
@@ -18,14 +18,14 @@ |
||
18 | 18 | * @param Exception $exception |
19 | 19 | * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse |
20 | 20 | */ |
21 | - public function render($request, Exception $exception) |
|
21 | + public function render( $request, Exception $exception ) |
|
22 | 22 | { |
23 | - $this->transformException($exception); |
|
23 | + $this->transformException( $exception ); |
|
24 | 24 | |
25 | - if ($exception instanceof ApiException) { |
|
26 | - return $this->renderApiError($exception); |
|
25 | + if ( $exception instanceof ApiException ) { |
|
26 | + return $this->renderApiError( $exception ); |
|
27 | 27 | } |
28 | 28 | |
29 | - return parent::render($request, $exception); |
|
29 | + return parent::render( $request, $exception ); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @param \Illuminate\Contracts\Routing\ResponseFactory $responseFactory |
47 | 47 | */ |
48 | - public function __construct(ResponseFactory $responseFactory) |
|
48 | + public function __construct( ResponseFactory $responseFactory ) |
|
49 | 49 | { |
50 | 50 | $this->responseFactory = $responseFactory; |
51 | 51 | } |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | * @param array $headers |
58 | 58 | * @return \Illuminate\Http\JsonResponse |
59 | 59 | */ |
60 | - public function respond(int $statusCode = null, array $headers = []):JsonResponse |
|
60 | + public function respond( int $statusCode = null, array $headers = [ ] ):JsonResponse |
|
61 | 61 | { |
62 | - if (! is_null($statusCode)) { |
|
63 | - $this->setStatus($statusCode); |
|
62 | + if ( ! is_null( $statusCode ) ) { |
|
63 | + $this->setStatus( $statusCode ); |
|
64 | 64 | } |
65 | 65 | |
66 | - $data = $this->includeStatusCode($this->toArray()); |
|
66 | + $data = $this->includeStatusCode( $this->toArray() ); |
|
67 | 67 | |
68 | - return $this->responseFactory->json($data, $this->statusCode, $headers); |
|
68 | + return $this->responseFactory->json( $data, $this->statusCode, $headers ); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param int $statusCode |
75 | 75 | * @return self |
76 | 76 | */ |
77 | - public function setStatus(int $statusCode):ResponseBuilder |
|
77 | + public function setStatus( int $statusCode ):ResponseBuilder |
|
78 | 78 | { |
79 | 79 | $this->statusCode = $statusCode; |
80 | 80 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param bool $includeStatusCode |
88 | 88 | * @return self |
89 | 89 | */ |
90 | - public function setIncludeStatusCode(bool $includeStatusCode):ResponseBuilder |
|
90 | + public function setIncludeStatusCode( bool $includeStatusCode ):ResponseBuilder |
|
91 | 91 | { |
92 | 92 | $this->includeStatusCode = $includeStatusCode; |
93 | 93 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function toCollection():Collection |
103 | 103 | { |
104 | - return new Collection($this->toArray()); |
|
104 | + return new Collection( $this->toArray() ); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | * @param int $options |
111 | 111 | * @return string |
112 | 112 | */ |
113 | - public function toJson($options = 0) |
|
113 | + public function toJson( $options = 0 ) |
|
114 | 114 | { |
115 | - return json_encode($this->jsonSerialize(), $options); |
|
115 | + return json_encode( $this->jsonSerialize(), $options ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | * @param array $data |
139 | 139 | * @return array |
140 | 140 | */ |
141 | - protected function includeStatusCode(array $data):array |
|
141 | + protected function includeStatusCode( array $data ):array |
|
142 | 142 | { |
143 | - if (! $this->includeStatusCode) { |
|
143 | + if ( ! $this->includeStatusCode ) { |
|
144 | 144 | return $data; |
145 | 145 | } |
146 | 146 | |
147 | - return array_merge(['status' => $this->statusCode], $data); |
|
147 | + return array_merge( [ 'status' => $this->statusCode ], $data ); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | \ No newline at end of file |