@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @param \Illuminate\Contracts\Routing\ResponseFactory|\Laravel\Lumen\Http\ResponseFactory $responseFactory |
| 61 | 61 | */ |
| 62 | - public function __construct($responseFactory) |
|
| 62 | + public function __construct( $responseFactory ) |
|
| 63 | 63 | { |
| 64 | 64 | $this->responseFactory = $responseFactory; |
| 65 | 65 | } |
@@ -71,17 +71,17 @@ discard block |
||
| 71 | 71 | * @param array $headers |
| 72 | 72 | * @return \Illuminate\Http\JsonResponse |
| 73 | 73 | */ |
| 74 | - public function respond(int $statusCode = null, array $headers = []):JsonResponse |
|
| 74 | + public function respond( int $statusCode = null, array $headers = [ ] ):JsonResponse |
|
| 75 | 75 | { |
| 76 | - if (! is_null($statusCode)) { |
|
| 77 | - $this->setStatus($statusCode); |
|
| 76 | + if ( ! is_null( $statusCode ) ) { |
|
| 77 | + $this->setStatus( $statusCode ); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $data = $this->toArray(); |
| 81 | - $data = $this->includeStatusCode($data); |
|
| 82 | - $data = $this->includeSuccessFlag($data); |
|
| 81 | + $data = $this->includeStatusCode( $data ); |
|
| 82 | + $data = $this->includeSuccessFlag( $data ); |
|
| 83 | 83 | |
| 84 | - return $this->responseFactory->json($data, $this->statusCode, $headers); |
|
| 84 | + return $this->responseFactory->json( $data, $this->statusCode, $headers ); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param int $statusCode |
| 91 | 91 | * @return self |
| 92 | 92 | */ |
| 93 | - public function setStatus(int $statusCode):ResponseBuilder |
|
| 93 | + public function setStatus( int $statusCode ):ResponseBuilder |
|
| 94 | 94 | { |
| 95 | 95 | $this->statusCode = $statusCode; |
| 96 | 96 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @param bool $includeSuccessFlag |
| 111 | 111 | * @return self |
| 112 | 112 | */ |
| 113 | - public function setIncludeSuccessFlag(bool $includeSuccessFlag):ResponseBuilder |
|
| 113 | + public function setIncludeSuccessFlag( bool $includeSuccessFlag ):ResponseBuilder |
|
| 114 | 114 | { |
| 115 | 115 | $this->includeSuccessFlag = $includeSuccessFlag; |
| 116 | 116 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @param bool $includeStatusCode |
| 124 | 124 | * @return self |
| 125 | 125 | */ |
| 126 | - public function setIncludeStatusCode(bool $includeStatusCode):ResponseBuilder |
|
| 126 | + public function setIncludeStatusCode( bool $includeStatusCode ):ResponseBuilder |
|
| 127 | 127 | { |
| 128 | 128 | $this->includeStatusCode = $includeStatusCode; |
| 129 | 129 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function toCollection():Collection |
| 139 | 139 | { |
| 140 | - return new Collection($this->toArray()); |
|
| 140 | + return new Collection( $this->toArray() ); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | * @param int $options |
| 147 | 147 | * @return string |
| 148 | 148 | */ |
| 149 | - public function toJson($options = 0) |
|
| 149 | + public function toJson( $options = 0 ) |
|
| 150 | 150 | { |
| 151 | - return json_encode($this->jsonSerialize(), $options); |
|
| 151 | + return json_encode( $this->jsonSerialize(), $options ); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -174,13 +174,13 @@ discard block |
||
| 174 | 174 | * @param array $data |
| 175 | 175 | * @return array |
| 176 | 176 | */ |
| 177 | - protected function includeSuccessFlag(array $data):array |
|
| 177 | + protected function includeSuccessFlag( array $data ):array |
|
| 178 | 178 | { |
| 179 | - if (! $this->includeSuccessFlag) { |
|
| 179 | + if ( ! $this->includeSuccessFlag ) { |
|
| 180 | 180 | return $data; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - return array_merge(['success' => $this->isSuccessResponse()], $data); |
|
| 183 | + return array_merge( [ 'success' => $this->isSuccessResponse() ], $data ); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -189,12 +189,12 @@ discard block |
||
| 189 | 189 | * @param array $data |
| 190 | 190 | * @return array |
| 191 | 191 | */ |
| 192 | - protected function includeStatusCode(array $data):array |
|
| 192 | + protected function includeStatusCode( array $data ):array |
|
| 193 | 193 | { |
| 194 | - if (! $this->includeStatusCode) { |
|
| 194 | + if ( ! $this->includeStatusCode ) { |
|
| 195 | 195 | return $data; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - return array_merge(['status' => $this->statusCode], $data); |
|
| 198 | + return array_merge( [ 'status' => $this->statusCode ], $data ); |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | \ No newline at end of file |