@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * NOTE: not typehints due to compatibility with Laravel's method signature. |
88 | 88 | * @noinspection PhpMissingReturnTypeInspection |
89 | - * @noinspection ReturnTypeCanBeDeclaredInspection |
|
89 | + * @noinspection ReturnTypeCanBeDeclaredInspection |
|
90 | 90 | * @noinspection PhpMissingParamTypeInspection |
91 | 91 | */ |
92 | 92 | protected function mergeConfigFrom($path, $key) |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | Util::sortArrayByPri($merged_config['converter']['classes']); |
108 | 108 | |
109 | - $this->app['config']->set($key, $merged_config); |
|
110 | - } |
|
109 | + $this->app['config']->set($key, $merged_config); |
|
110 | + } |
|
111 | 111 | |
112 | 112 | } |
@@ -47,12 +47,12 @@ |
||
47 | 47 | |
48 | 48 | /** @var \Symfony\Component\HttpKernel\Exception\HttpException $ex */ |
49 | 49 | $http_code = $ex->getStatusCode(); |
50 | - $result = $config[ $http_code ] ?? null; |
|
50 | + $result = $config[$http_code] ?? null; |
|
51 | 51 | |
52 | 52 | // If we do not have dedicated entry fort this particular http_code, |
53 | 53 | // fall back to default value. |
54 | 54 | if ($result === null) { |
55 | - $result = $config[ RB::KEY_DEFAULT ]; |
|
55 | + $result = $config[RB::KEY_DEFAULT]; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | // Some defaults to fall back to if not set in user config. |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | do { |
58 | 58 | if ($cfg === null) { |
59 | 59 | // Default handler MUST be present by design and always return something useful. |
60 | - $cfg = self::getExceptionHandlerConfig()[ RB::KEY_DEFAULT ]; |
|
60 | + $cfg = self::getExceptionHandlerConfig()[RB::KEY_DEFAULT]; |
|
61 | 61 | } |
62 | 62 | |
63 | - $handler = new $cfg[ RB::KEY_HANDLER ](); |
|
64 | - $handler_result = $handler->handle($cfg[ RB::KEY_CONFIG ], $ex); |
|
63 | + $handler = new $cfg[RB::KEY_HANDLER](); |
|
64 | + $handler_result = $handler->handle($cfg[RB::KEY_CONFIG], $ex); |
|
65 | 65 | if ($handler_result !== null) { |
66 | 66 | $result = self::processException($ex, $handler_result); |
67 | 67 | } else { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $cfg = self::getExceptionHandlerConfig(); |
186 | 186 | |
187 | 187 | // This config entry is guaranted to exist. Enforced by tests. |
188 | - $cfg = $cfg[ HttpException::class ][ RB::KEY_CONFIG ][ HttpResponse::HTTP_UNAUTHORIZED ]; |
|
188 | + $cfg = $cfg[HttpException::class][RB::KEY_CONFIG][HttpResponse::HTTP_UNAUTHORIZED]; |
|
189 | 189 | |
190 | 190 | /** |
191 | 191 | * NOTE: no typehint due to compatibility with Laravel signature. |
@@ -329,14 +329,14 @@ discard block |
||
329 | 329 | |
330 | 330 | // check for exact class name match... |
331 | 331 | if (\array_key_exists($cls, $cfg)) { |
332 | - $result = $cfg[ $cls ]; |
|
332 | + $result = $cfg[$cls]; |
|
333 | 333 | } else { |
334 | 334 | // no exact match, then lets try with `instanceof` |
335 | 335 | // Config entries are already sorted by priority. |
336 | 336 | foreach (\array_keys($cfg) as $class_name) { |
337 | 337 | /** @var string $class_name */ |
338 | 338 | if ($ex instanceof $class_name) { |
339 | - $result = $cfg[ $class_name ]; |
|
339 | + $result = $cfg[$class_name]; |
|
340 | 340 | break; |
341 | 341 | } |
342 | 342 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @throws Ex\ArrayWithMixedKeysException |
98 | 98 | */ |
99 | 99 | protected static function processException(\Throwable $ex, array $ex_cfg, |
100 | - int $fallback_http_code = HttpResponse::HTTP_INTERNAL_SERVER_ERROR) |
|
100 | + int $fallback_http_code = HttpResponse::HTTP_INTERNAL_SERVER_ERROR) |
|
101 | 101 | { |
102 | 102 | $api_code = $ex_cfg['api_code']; |
103 | 103 | $http_code = $ex_cfg['http_code'] ?? $fallback_http_code; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @noinspection PhpMissingParamTypeInspection |
196 | 196 | */ |
197 | 197 | protected function unauthenticated(/** @scrutinizer ignore-unused */ $request, |
198 | - AuthException $exception): HttpResponse |
|
198 | + AuthException $exception): HttpResponse |
|
199 | 199 | { |
200 | 200 | $cfg = self::getExceptionHandlerConfig(); |
201 | 201 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @throws Ex\NotIntegerException |
228 | 228 | */ |
229 | 229 | protected static function error(Throwable $ex, |
230 | - int $api_code, int $http_code = null, string $error_message = null): HttpResponse |
|
230 | + int $api_code, int $http_code = null, string $error_message = null): HttpResponse |
|
231 | 231 | { |
232 | 232 | $ex_http_code = ($ex instanceof HttpException) ? $ex->getStatusCode() : $ex->getCode(); |
233 | 233 | $http_code = $http_code ?? $ex_http_code; |
@@ -391,11 +391,11 @@ discard block |
||
391 | 391 | $data = (new Converter())->convert($data); |
392 | 392 | if ($data !== null) { |
393 | 393 | // ensure we get object in final JSON structure in data node |
394 | - $data = (object)$data; |
|
394 | + $data = (object) $data; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | if ($data === null && Config::get(RB::CONF_KEY_DATA_ALWAYS_OBJECT, false)) { |
398 | - $data = (object)[]; |
|
398 | + $data = (object) []; |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | // get human readable message for API code or use message string (if given instead of API code) |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | |
418 | 418 | if ($debug_data !== null) { |
419 | 419 | $debug_key = Config::get(RB::CONF_KEY_DEBUG_DEBUG_KEY, RB::KEY_DEBUG); |
420 | - $response[ $debug_key ] = $debug_data; |
|
420 | + $response[$debug_key] = $debug_data; |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | return $response; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @throws Ex\NotIntegerException |
93 | 93 | */ |
94 | 94 | public static function success($data = null, int $api_code = null, array $placeholders = null, |
95 | - int $http_code = null, int $json_opts = null): HttpResponse |
|
95 | + int $http_code = null, int $json_opts = null): HttpResponse |
|
96 | 96 | { |
97 | 97 | return static::asSuccess($api_code) |
98 | 98 | ->withData($data) |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @throws Ex\NotIntegerException |
128 | 128 | */ |
129 | 129 | public static function error(int $api_code, array $placeholders = null, $data = null, int $http_code = null, |
130 | - int $json_opts = null): HttpResponse |
|
130 | + int $json_opts = null): HttpResponse |
|
131 | 131 | { |
132 | 132 | return static::asError($api_code) |
133 | 133 | ->withPlaceholders($placeholders) |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | public function withJsonOptions(int $json_opts = null): self |
230 | 230 | { |
231 | 231 | Validator::assertIsType('json_opts', $json_opts, [Type::INTEGER, |
232 | - Type::NULL]); |
|
232 | + Type::NULL]); |
|
233 | 233 | $this->json_opts = $json_opts; |
234 | 234 | |
235 | 235 | return $this; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | public function withDebugData(array $debug_data = null): self |
246 | 246 | { |
247 | 247 | Validator::assertIsType('$debug_data', $debug_data, [Type::ARRAY, |
248 | - Type::NULL]); |
|
248 | + Type::NULL]); |
|
249 | 249 | $this->debug_data = $debug_data; |
250 | 250 | |
251 | 251 | return $this; |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | public function withMessage(string $msg = null): self |
262 | 262 | { |
263 | 263 | Validator::assertIsType('message', $msg, [Type::STRING, |
264 | - Type::NULL]); |
|
264 | + Type::NULL]); |
|
265 | 265 | $this->message = $msg; |
266 | 266 | |
267 | 267 | return $this; |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | * @noinspection PhpTooManyParametersInspection |
361 | 361 | */ |
362 | 362 | protected function make(bool $success, int $api_code, $msg_or_api_code, $data = null, |
363 | - int $http_code = null, array $placeholders = null, array $http_headers = null, |
|
364 | - int $json_opts = null, array $debug_data = null): HttpResponse |
|
363 | + int $http_code = null, array $placeholders = null, array $http_headers = null, |
|
364 | + int $json_opts = null, array $debug_data = null): HttpResponse |
|
365 | 365 | { |
366 | 366 | $http_headers = $http_headers ?? []; |
367 | 367 | $http_code = $http_code ?? ($success ? RB::DEFAULT_HTTP_CODE_OK : RB::DEFAULT_HTTP_CODE_ERROR); |
@@ -405,8 +405,8 @@ discard block |
||
405 | 405 | * @noinspection PhpTooManyParametersInspection |
406 | 406 | */ |
407 | 407 | protected function buildResponse(bool $success, int $api_code, |
408 | - $msg_or_api_code, array $placeholders = null, |
|
409 | - $data = null, array $debug_data = null): array |
|
408 | + $msg_or_api_code, array $placeholders = null, |
|
409 | + $data = null, array $debug_data = null): array |
|
410 | 410 | { |
411 | 411 | // ensure $data is either @null, array or object of class with configured mapping. |
412 | 412 | $data = (new Converter())->convert($data); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | protected function getPrimitiveMappingConfigOrThrow($data): array |
63 | 63 | { |
64 | 64 | $type = \gettype($data); |
65 | - $result = $this->primitives[ $type ] ?? null; |
|
65 | + $result = $this->primitives[$type] ?? null; |
|
66 | 66 | |
67 | 67 | if ($result === null) { |
68 | 68 | throw new Ex\ConfigurationNotFoundException( |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | $cls = \get_class($data); |
95 | 95 | if (\is_string($cls)) { |
96 | 96 | if (\array_key_exists($cls, $this->classes)) { |
97 | - $result = $this->classes[ $cls ]; |
|
97 | + $result = $this->classes[$cls]; |
|
98 | 98 | $debug_result = 'exact config match'; |
99 | 99 | } else { |
100 | 100 | // no exact match, then lets try with `instanceof` |
101 | 101 | foreach (\array_keys($this->classes) as $class_name) { |
102 | 102 | /** @var string $class_name */ |
103 | 103 | if ($data instanceof $class_name) { |
104 | - $result = $this->classes[ $class_name ]; |
|
104 | + $result = $this->classes[$class_name]; |
|
105 | 105 | $debug_result = "subclass of {$class_name}"; |
106 | 106 | break; |
107 | 107 | } |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | |
151 | 151 | if ($result === null && \is_object($data)) { |
152 | 152 | $cfg = $this->getClassMappingConfigOrThrow($data); |
153 | - $worker = new $cfg[ RB::KEY_HANDLER ](); |
|
153 | + $worker = new $cfg[RB::KEY_HANDLER](); |
|
154 | 154 | $result = $worker->convert($data, $cfg); |
155 | - $result = $cfg[ RB::KEY_KEY ] === null ? $result : [$cfg[ RB::KEY_KEY ] => $result]; |
|
155 | + $result = $cfg[RB::KEY_KEY] === null ? $result : [$cfg[RB::KEY_KEY] => $result]; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | if ($result === null && \is_array($data)) { |
@@ -160,12 +160,12 @@ discard block |
||
160 | 160 | |
161 | 161 | $result = $this->convertArray($data); |
162 | 162 | if (!Util::isArrayWithNonNumericKeys($data)) { |
163 | - $result = [$cfg[ RB::KEY_KEY ] => $result]; |
|
163 | + $result = [$cfg[RB::KEY_KEY] => $result]; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | 167 | if (\is_bool($data) || \is_float($data) || \is_int($data) || \is_string($data)) { |
168 | - $result = [$this->getPrimitiveMappingConfigOrThrow($data)[ RB::KEY_KEY ] => $data]; |
|
168 | + $result = [$this->getPrimitiveMappingConfigOrThrow($data)[RB::KEY_KEY] => $data]; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | return $result; |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | |
189 | 189 | foreach ($data as $key => $val) { |
190 | 190 | if (\is_array($val)) { |
191 | - $data[ $key ] = $this->convertArray($val); |
|
191 | + $data[$key] = $this->convertArray($val); |
|
192 | 192 | } elseif (\is_object($val)) { |
193 | 193 | $cfg = $this->getClassMappingConfigOrThrow($val); |
194 | - $worker = new $cfg[ RB::KEY_HANDLER ](); |
|
194 | + $worker = new $cfg[RB::KEY_HANDLER](); |
|
195 | 195 | $converted_data = $worker->convert($val, $cfg); |
196 | - $data[ $key ] = $converted_data; |
|
196 | + $data[$key] = $converted_data; |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 |
@@ -43,6 +43,6 @@ |
||
43 | 43 | $encoded = ''; |
44 | 44 | } |
45 | 45 | |
46 | - return [$config[ RB::KEY_KEY ] => \json_decode($encoded, true)]; |
|
46 | + return [$config[RB::KEY_KEY] => \json_decode($encoded, true)]; |
|
47 | 47 | } |
48 | 48 | } |
@@ -161,7 +161,7 @@ |
||
161 | 161 | * @throws Ex\InvalidTypeException |
162 | 162 | */ |
163 | 163 | public static function assertIsType(string $var_name, $value, array $allowed_types, |
164 | - string $ex_class = Ex\InvalidTypeException::class): void |
|
164 | + string $ex_class = Ex\InvalidTypeException::class): void |
|
165 | 165 | { |
166 | 166 | // Type::EXISTING_CLASS is artificial type, so we need separate logic to handle it. |
167 | 167 | $tmp = $allowed_types; |
@@ -22,72 +22,72 @@ discard block |
||
22 | 22 | */ |
23 | 23 | class BaseApiCodes |
24 | 24 | { |
25 | - use ApiCodesHelpers; |
|
26 | - |
|
27 | - /** |
|
28 | - * protected code range - lowest code for reserved range. |
|
29 | - * |
|
30 | - * @var int |
|
31 | - */ |
|
32 | - public const RESERVED_MIN_API_CODE_OFFSET = 0; |
|
33 | - |
|
34 | - /** |
|
35 | - * protected code range - highest code for reserved range |
|
36 | - * |
|
37 | - * @var int |
|
38 | - */ |
|
39 | - public const RESERVED_MAX_API_CODE_OFFSET = 19; |
|
40 | - |
|
41 | - /** |
|
42 | - * built-in codes: OK |
|
43 | - * |
|
44 | - * @var int |
|
45 | - */ |
|
46 | - protected const OK_OFFSET = 0; |
|
47 | - /** |
|
48 | - * built-in code for fallback message mapping |
|
49 | - * |
|
50 | - * @var int |
|
51 | - */ |
|
52 | - protected const NO_ERROR_MESSAGE_OFFSET = 1; |
|
53 | - /** |
|
54 | - * built-in error code for HTTP_NOT_FOUND exception |
|
55 | - * |
|
56 | - * @var int |
|
57 | - */ |
|
58 | - protected const EX_HTTP_NOT_FOUND_OFFSET = 10; |
|
59 | - /** |
|
60 | - * built-in error code for HTTP_SERVICE_UNAVAILABLE exception |
|
61 | - * |
|
62 | - * @var int |
|
63 | - */ |
|
64 | - protected const EX_HTTP_SERVICE_UNAVAILABLE_OFFSET = 11; |
|
65 | - /** |
|
66 | - * built-in error code for HTTP_EXCEPTION |
|
67 | - * |
|
68 | - * @var int |
|
69 | - */ |
|
70 | - protected const EX_HTTP_EXCEPTION_OFFSET = 12; |
|
71 | - /** |
|
72 | - * built-in error code for UNCAUGHT_EXCEPTION |
|
73 | - * |
|
74 | - * @var int |
|
75 | - */ |
|
76 | - protected const EX_UNCAUGHT_EXCEPTION_OFFSET = 13; |
|
77 | - |
|
78 | - /** |
|
79 | - * built-in error code for \Illuminate\Auth\AuthenticationException |
|
80 | - * |
|
81 | - * @var int |
|
82 | - */ |
|
83 | - protected const EX_AUTHENTICATION_EXCEPTION_OFFSET = 14; |
|
84 | - |
|
85 | - /** |
|
86 | - * built-in error code for \Illuminate\Auth\AuthenticationException |
|
87 | - * |
|
88 | - * @var int |
|
89 | - */ |
|
90 | - protected const EX_VALIDATION_EXCEPTION_OFFSET = 15; |
|
25 | + use ApiCodesHelpers; |
|
26 | + |
|
27 | + /** |
|
28 | + * protected code range - lowest code for reserved range. |
|
29 | + * |
|
30 | + * @var int |
|
31 | + */ |
|
32 | + public const RESERVED_MIN_API_CODE_OFFSET = 0; |
|
33 | + |
|
34 | + /** |
|
35 | + * protected code range - highest code for reserved range |
|
36 | + * |
|
37 | + * @var int |
|
38 | + */ |
|
39 | + public const RESERVED_MAX_API_CODE_OFFSET = 19; |
|
40 | + |
|
41 | + /** |
|
42 | + * built-in codes: OK |
|
43 | + * |
|
44 | + * @var int |
|
45 | + */ |
|
46 | + protected const OK_OFFSET = 0; |
|
47 | + /** |
|
48 | + * built-in code for fallback message mapping |
|
49 | + * |
|
50 | + * @var int |
|
51 | + */ |
|
52 | + protected const NO_ERROR_MESSAGE_OFFSET = 1; |
|
53 | + /** |
|
54 | + * built-in error code for HTTP_NOT_FOUND exception |
|
55 | + * |
|
56 | + * @var int |
|
57 | + */ |
|
58 | + protected const EX_HTTP_NOT_FOUND_OFFSET = 10; |
|
59 | + /** |
|
60 | + * built-in error code for HTTP_SERVICE_UNAVAILABLE exception |
|
61 | + * |
|
62 | + * @var int |
|
63 | + */ |
|
64 | + protected const EX_HTTP_SERVICE_UNAVAILABLE_OFFSET = 11; |
|
65 | + /** |
|
66 | + * built-in error code for HTTP_EXCEPTION |
|
67 | + * |
|
68 | + * @var int |
|
69 | + */ |
|
70 | + protected const EX_HTTP_EXCEPTION_OFFSET = 12; |
|
71 | + /** |
|
72 | + * built-in error code for UNCAUGHT_EXCEPTION |
|
73 | + * |
|
74 | + * @var int |
|
75 | + */ |
|
76 | + protected const EX_UNCAUGHT_EXCEPTION_OFFSET = 13; |
|
77 | + |
|
78 | + /** |
|
79 | + * built-in error code for \Illuminate\Auth\AuthenticationException |
|
80 | + * |
|
81 | + * @var int |
|
82 | + */ |
|
83 | + protected const EX_AUTHENTICATION_EXCEPTION_OFFSET = 14; |
|
84 | + |
|
85 | + /** |
|
86 | + * built-in error code for \Illuminate\Auth\AuthenticationException |
|
87 | + * |
|
88 | + * @var int |
|
89 | + */ |
|
90 | + protected const EX_VALIDATION_EXCEPTION_OFFSET = 15; |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * Returns base code mapping array |
@@ -100,21 +100,21 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @noinspection PhpUnhandledExceptionInspection |
102 | 102 | */ |
103 | - protected static function getBaseMap(): array |
|
104 | - { |
|
105 | - $tpl = 'response-builder::builder.http_%d'; |
|
106 | - |
|
107 | - return [ |
|
108 | - self::OK() => 'response-builder::builder.ok', |
|
109 | - self::NO_ERROR_MESSAGE() => 'response-builder::builder.no_error_message', |
|
110 | - self::EX_HTTP_EXCEPTION() => 'response-builder::builder.http_exception', |
|
111 | - self::EX_UNCAUGHT_EXCEPTION() => 'response-builder::builder.uncaught_exception', |
|
112 | - self::EX_HTTP_NOT_FOUND() => sprintf($tpl, HttpResponse::HTTP_NOT_FOUND), |
|
113 | - self::EX_HTTP_SERVICE_UNAVAILABLE() => sprintf($tpl, HttpResponse::HTTP_SERVICE_UNAVAILABLE), |
|
114 | - self::EX_AUTHENTICATION_EXCEPTION() => sprintf($tpl, HttpResponse::HTTP_UNAUTHORIZED), |
|
115 | - self::EX_VALIDATION_EXCEPTION() => sprintf($tpl, HttpResponse::HTTP_UNPROCESSABLE_ENTITY), |
|
116 | - ]; |
|
117 | - } |
|
103 | + protected static function getBaseMap(): array |
|
104 | + { |
|
105 | + $tpl = 'response-builder::builder.http_%d'; |
|
106 | + |
|
107 | + return [ |
|
108 | + self::OK() => 'response-builder::builder.ok', |
|
109 | + self::NO_ERROR_MESSAGE() => 'response-builder::builder.no_error_message', |
|
110 | + self::EX_HTTP_EXCEPTION() => 'response-builder::builder.http_exception', |
|
111 | + self::EX_UNCAUGHT_EXCEPTION() => 'response-builder::builder.uncaught_exception', |
|
112 | + self::EX_HTTP_NOT_FOUND() => sprintf($tpl, HttpResponse::HTTP_NOT_FOUND), |
|
113 | + self::EX_HTTP_SERVICE_UNAVAILABLE() => sprintf($tpl, HttpResponse::HTTP_SERVICE_UNAVAILABLE), |
|
114 | + self::EX_AUTHENTICATION_EXCEPTION() => sprintf($tpl, HttpResponse::HTTP_UNAUTHORIZED), |
|
115 | + self::EX_VALIDATION_EXCEPTION() => sprintf($tpl, HttpResponse::HTTP_UNPROCESSABLE_ENTITY), |
|
116 | + ]; |
|
117 | + } |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * Returns API code for internal code OK |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @noinspection PhpMethodNamingConventionInspection |
129 | 129 | */ |
130 | - public static function OK(): int |
|
131 | - { |
|
132 | - return static::getCodeForInternalOffset(static::OK_OFFSET); |
|
133 | - } |
|
130 | + public static function OK(): int |
|
131 | + { |
|
132 | + return static::getCodeForInternalOffset(static::OK_OFFSET); |
|
133 | + } |
|
134 | 134 | |
135 | 135 | /** |
136 | 136 | * Returns API code for internal code NO_ERROR_MESSAGE |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @noinspection PhpMethodNamingConventionInspection |
145 | 145 | */ |
146 | - public static function NO_ERROR_MESSAGE(): int |
|
147 | - { |
|
148 | - return static::getCodeForInternalOffset(static::NO_ERROR_MESSAGE_OFFSET); |
|
149 | - } |
|
146 | + public static function NO_ERROR_MESSAGE(): int |
|
147 | + { |
|
148 | + return static::getCodeForInternalOffset(static::NO_ERROR_MESSAGE_OFFSET); |
|
149 | + } |
|
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Returns API code for internal code EX_HTTP_NOT_FOUND |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @noinspection PhpMethodNamingConventionInspection |
161 | 161 | */ |
162 | - public static function EX_HTTP_NOT_FOUND(): int |
|
163 | - { |
|
164 | - return static::getCodeForInternalOffset(static::EX_HTTP_NOT_FOUND_OFFSET); |
|
165 | - } |
|
162 | + public static function EX_HTTP_NOT_FOUND(): int |
|
163 | + { |
|
164 | + return static::getCodeForInternalOffset(static::EX_HTTP_NOT_FOUND_OFFSET); |
|
165 | + } |
|
166 | 166 | |
167 | 167 | /** |
168 | 168 | * Returns API code for internal code EX_HTTP_EXCEPTION |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @noinspection PhpMethodNamingConventionInspection |
177 | 177 | */ |
178 | - public static function EX_HTTP_EXCEPTION(): int |
|
179 | - { |
|
180 | - return static::getCodeForInternalOffset(static::EX_HTTP_EXCEPTION_OFFSET); |
|
181 | - } |
|
178 | + public static function EX_HTTP_EXCEPTION(): int |
|
179 | + { |
|
180 | + return static::getCodeForInternalOffset(static::EX_HTTP_EXCEPTION_OFFSET); |
|
181 | + } |
|
182 | 182 | |
183 | 183 | /** |
184 | 184 | * Returns API code for internal code EX_UNCAUGHT_EXCEPTION |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @noinspection PhpMethodNamingConventionInspection |
193 | 193 | */ |
194 | - public static function EX_UNCAUGHT_EXCEPTION(): int |
|
195 | - { |
|
196 | - return static::getCodeForInternalOffset(static::EX_UNCAUGHT_EXCEPTION_OFFSET); |
|
197 | - } |
|
194 | + public static function EX_UNCAUGHT_EXCEPTION(): int |
|
195 | + { |
|
196 | + return static::getCodeForInternalOffset(static::EX_UNCAUGHT_EXCEPTION_OFFSET); |
|
197 | + } |
|
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Returns API code for internal code EX_AUTHENTICATION_EXCEPTION |
@@ -207,10 +207,10 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @noinspection PhpMethodNamingConventionInspection |
209 | 209 | */ |
210 | - public static function EX_AUTHENTICATION_EXCEPTION(): int |
|
211 | - { |
|
212 | - return static::getCodeForInternalOffset(static::EX_AUTHENTICATION_EXCEPTION_OFFSET); |
|
213 | - } |
|
210 | + public static function EX_AUTHENTICATION_EXCEPTION(): int |
|
211 | + { |
|
212 | + return static::getCodeForInternalOffset(static::EX_AUTHENTICATION_EXCEPTION_OFFSET); |
|
213 | + } |
|
214 | 214 | |
215 | 215 | /** |
216 | 216 | * Returns API code for internal code EX_VALIDATION_EXCEPTION |
@@ -223,10 +223,10 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @noinspection PhpMethodNamingConventionInspection |
225 | 225 | */ |
226 | - public static function EX_VALIDATION_EXCEPTION(): int |
|
227 | - { |
|
228 | - return static::getCodeForInternalOffset(static::EX_VALIDATION_EXCEPTION_OFFSET); |
|
229 | - } |
|
226 | + public static function EX_VALIDATION_EXCEPTION(): int |
|
227 | + { |
|
228 | + return static::getCodeForInternalOffset(static::EX_VALIDATION_EXCEPTION_OFFSET); |
|
229 | + } |
|
230 | 230 | |
231 | 231 | /** |
232 | 232 | * Returns API code for internal code EX_HTTP_SERVICE_UNAVAILABLE |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @noinspection PhpMethodNamingConventionInspection |
241 | 241 | */ |
242 | - public static function EX_HTTP_SERVICE_UNAVAILABLE(): int |
|
243 | - { |
|
244 | - return static::getCodeForInternalOffset(static::EX_HTTP_SERVICE_UNAVAILABLE_OFFSET); |
|
245 | - } |
|
242 | + public static function EX_HTTP_SERVICE_UNAVAILABLE(): int |
|
243 | + { |
|
244 | + return static::getCodeForInternalOffset(static::EX_HTTP_SERVICE_UNAVAILABLE_OFFSET); |
|
245 | + } |
|
246 | 246 | |
247 | 247 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $array = $original; |
41 | 41 | foreach ($merging as $m_key => $m_val) { |
42 | 42 | if (\array_key_exists($m_key, $original)) { |
43 | - $orig_type = \gettype($original[ $m_key ]); |
|
43 | + $orig_type = \gettype($original[$m_key]); |
|
44 | 44 | $m_type = \gettype($m_val); |
45 | 45 | if ($orig_type !== $m_type) { |
46 | 46 | throw new Ex\IncompatibleTypeException( |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | |
50 | 50 | if (\is_array($m_val)) { |
51 | 51 | /** @noinspection PhpUnnecessaryStaticReferenceInspection */ |
52 | - $array[ $m_key ] = static::mergeConfig($original[ $m_key ], $m_val); |
|
52 | + $array[$m_key] = static::mergeConfig($original[$m_key], $m_val); |
|
53 | 53 | } else { |
54 | - $array[ $m_key ] = $m_val; |
|
54 | + $array[$m_key] = $m_val; |
|
55 | 55 | } |
56 | 56 | } else { |
57 | - $array[ $m_key ] = $m_val; |
|
57 | + $array[$m_key] = $m_val; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 |