@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @var array |
21 | 21 | */ |
22 | - protected $data = []; |
|
22 | + protected $data = [ ]; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * The error code used to identify the error. |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @var array |
42 | 42 | */ |
43 | - protected $parameters = []; |
|
43 | + protected $parameters = [ ]; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * The HTTP status code for the response. |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | * @param \Illuminate\Contracts\Routing\ResponseFactory|\Laravel\Lumen\Http\ResponseFactory $responseFactory |
63 | 63 | * @param \Symfony\Component\Translation\TranslatorInterface|Illuminate\Contracts\Translation\Translator $translator |
64 | 64 | */ |
65 | - public function __construct($responseFactory, $translator) |
|
65 | + public function __construct( $responseFactory, $translator ) |
|
66 | 66 | { |
67 | 67 | $this->translator = $translator; |
68 | 68 | |
69 | - parent::__construct($responseFactory); |
|
69 | + parent::__construct( $responseFactory ); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | * @param array $data |
76 | 76 | * @return self |
77 | 77 | */ |
78 | - public function addData(array $data):ErrorResponseBuilder |
|
78 | + public function addData( array $data ):ErrorResponseBuilder |
|
79 | 79 | { |
80 | - $this->data = array_merge($this->data, $data); |
|
80 | + $this->data = array_merge( $this->data, $data ); |
|
81 | 81 | |
82 | 82 | return $this; |
83 | 83 | } |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | * @param string|array|null $message |
90 | 90 | * @return self |
91 | 91 | */ |
92 | - public function setError(string $errorCode = null, $message = null):ErrorResponseBuilder |
|
92 | + public function setError( string $errorCode = null, $message = null ):ErrorResponseBuilder |
|
93 | 93 | { |
94 | 94 | $this->errorCode = $errorCode; |
95 | 95 | |
96 | - if (is_array($message)) { |
|
96 | + if ( is_array( $message ) ) { |
|
97 | 97 | $this->parameters = $message; |
98 | 98 | } else { |
99 | 99 | $this->message = $message; |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | * @return self |
110 | 110 | * @throws \InvalidArgumentException |
111 | 111 | */ |
112 | - public function setStatus(int $statusCode):ResponseBuilder |
|
112 | + public function setStatus( int $statusCode ):ResponseBuilder |
|
113 | 113 | { |
114 | - if ($statusCode < 400 || $statusCode >= 600) { |
|
115 | - throw new InvalidArgumentException("{$statusCode} is not a valid error HTTP status code."); |
|
114 | + if ( $statusCode < 400 || $statusCode >= 600 ) { |
|
115 | + throw new InvalidArgumentException( "{$statusCode} is not a valid error HTTP status code." ); |
|
116 | 116 | } |
117 | 117 | |
118 | - return parent::setStatus($statusCode); |
|
118 | + return parent::setStatus( $statusCode ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | protected function buildErrorData() |
140 | 140 | { |
141 | - if (is_null($this->errorCode)) { |
|
141 | + if ( is_null( $this->errorCode ) ) { |
|
142 | 142 | return null; |
143 | 143 | } |
144 | 144 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | 'message' => $this->message ?: $this->resolveMessage() |
148 | 148 | ]; |
149 | 149 | |
150 | - return array_merge($data, $this->data); |
|
150 | + return array_merge( $data, $this->data ); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | */ |
158 | 158 | protected function resolveMessage() |
159 | 159 | { |
160 | - if (! $this->translator->has($code = "errors.$this->errorCode")) { |
|
160 | + if ( ! $this->translator->has( $code = "errors.$this->errorCode" ) ) { |
|
161 | 161 | return null; |
162 | 162 | } |
163 | 163 | |
164 | - return $this->translator->trans($code, $this->parameters); |
|
164 | + return $this->translator->trans( $code, $this->parameters ); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | \ No newline at end of file |