@@ -112,7 +112,7 @@ |
||
112 | 112 | |
113 | 113 | $map = static::getMap(); |
114 | 114 | |
115 | - return $map[ $api_code ] ?? null; |
|
115 | + return $map[$api_code] ?? null; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | 'http_422' => 'Kann nicht verarbeitet werden', |
45 | 45 | 'http_423' => 'Gesperrt', |
46 | 46 | 'http_424' => 'Vorhergehende Bedingung nicht erfüllt', |
47 | - 'http_425' => 'Too Early', // FIXME |
|
47 | + 'http_425' => 'Too Early', // FIXME |
|
48 | 48 | 'http_426' => 'Update benötigt', |
49 | 49 | 'http_428' => ' Vorbedingung benötigt', |
50 | 50 | 'http_429' => 'Zu viele Anfragen', |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | 'http_503' => 'Dienst nicht verfügbar', |
58 | 58 | 'http_504' => 'Portal-Auszeit', |
59 | 59 | 'http_505' => 'HTTP-Version nicht unterstützt', |
60 | - 'http_506' => 'Variant Also Negotiates', // FIXME |
|
60 | + 'http_506' => 'Variant Also Negotiates', // FIXME |
|
61 | 61 | 'http_507' => 'Speicher des Servers reicht nicht aus', |
62 | 62 | 'http_508' => 'Endlosschleife', |
63 | - 'http_509' => 'Unassigned', // FIXME |
|
63 | + 'http_509' => 'Unassigned', // FIXME |
|
64 | 64 | 'http_510' => 'Zu wenig Informationen', |
65 | 65 | 'http_511' => 'Identizifierung benötigt', |
66 | 66 | ]; |
@@ -359,11 +359,11 @@ discard block |
||
359 | 359 | $data = (new Converter())->convert($data); |
360 | 360 | if ($data !== null && !\is_object($data)) { |
361 | 361 | // ensure we get object in final JSON structure in data node |
362 | - $data = (object)$data; |
|
362 | + $data = (object) $data; |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | if ($data === null && Config::get(RB::CONF_KEY_DATA_ALWAYS_OBJECT, false)) { |
366 | - $data = (object)[]; |
|
366 | + $data = (object) []; |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | // get human readable message for API code or use message string (if given instead of API code) |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | |
386 | 386 | if ($debug_data !== null) { |
387 | 387 | $debug_key = Config::get(RB::CONF_KEY_DEBUG_DEBUG_KEY, RB::KEY_DEBUG); |
388 | - $response[ $debug_key ] = $debug_data; |
|
388 | + $response[$debug_key] = $debug_data; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | return $response; |
@@ -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 { |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $cfg = self::getExceptionHandlerConfig(); |
184 | 184 | |
185 | 185 | // This config entry is guaranted to exist. Enforced by tests. |
186 | - $cfg = $cfg[ HttpException::class ][ RB::KEY_CONFIG ][ HttpResponse::HTTP_UNAUTHORIZED ]; |
|
186 | + $cfg = $cfg[HttpException::class][RB::KEY_CONFIG][HttpResponse::HTTP_UNAUTHORIZED]; |
|
187 | 187 | |
188 | 188 | /** |
189 | 189 | * NOTE: no typehint due to compatibility with Laravel signature. |
@@ -328,13 +328,13 @@ discard block |
||
328 | 328 | |
329 | 329 | // check for exact class name match... |
330 | 330 | if (\array_key_exists($cls, $cfg)) { |
331 | - $result = $cfg[ $cls ]; |
|
331 | + $result = $cfg[$cls]; |
|
332 | 332 | } else { |
333 | 333 | // no exact match, then lets try with `instanceof` |
334 | 334 | // Config entries are already sorted by priority. |
335 | 335 | foreach (\array_keys($cfg) as $class_name) { |
336 | 336 | if ($ex instanceof $class_name) { |
337 | - $result = $cfg[ $class_name ]; |
|
337 | + $result = $cfg[$class_name]; |
|
338 | 338 | break; |
339 | 339 | } |
340 | 340 | } |
@@ -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,13 +94,13 @@ 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 | if ($data instanceof $class_name) { |
103 | - $result = $this->classes[ $class_name ]; |
|
103 | + $result = $this->classes[$class_name]; |
|
104 | 104 | $debug_result = "subclass of {$class_name}"; |
105 | 105 | break; |
106 | 106 | } |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | |
150 | 150 | if ($result === null && \is_object($data)) { |
151 | 151 | $cfg = $this->getClassMappingConfigOrThrow($data); |
152 | - $worker = new $cfg[ RB::KEY_HANDLER ](); |
|
152 | + $worker = new $cfg[RB::KEY_HANDLER](); |
|
153 | 153 | $result = $worker->convert($data, $cfg); |
154 | - $result = $cfg[ RB::KEY_KEY ] === null ? $result : [$cfg[ RB::KEY_KEY ] => $result]; |
|
154 | + $result = $cfg[RB::KEY_KEY] === null ? $result : [$cfg[RB::KEY_KEY] => $result]; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | if ($result === null && \is_array($data)) { |
@@ -159,12 +159,12 @@ discard block |
||
159 | 159 | |
160 | 160 | $result = $this->convertArray($data); |
161 | 161 | if (!Util::isArrayWithNonNumericKeys($data)) { |
162 | - $result = [$cfg[ RB::KEY_KEY ] => $result]; |
|
162 | + $result = [$cfg[RB::KEY_KEY] => $result]; |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | 166 | if (\is_bool($data) || \is_float($data) || \is_int($data) || \is_string($data)) { |
167 | - $result = [$this->getPrimitiveMappingConfigOrThrow($data)[ RB::KEY_KEY ] => $data]; |
|
167 | + $result = [$this->getPrimitiveMappingConfigOrThrow($data)[RB::KEY_KEY] => $data]; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | return $result; |
@@ -187,12 +187,12 @@ discard block |
||
187 | 187 | |
188 | 188 | foreach ($data as $key => $val) { |
189 | 189 | if (\is_array($val)) { |
190 | - $data[ $key ] = $this->convertArray($val); |
|
190 | + $data[$key] = $this->convertArray($val); |
|
191 | 191 | } elseif (\is_object($val)) { |
192 | 192 | $cfg = $this->getClassMappingConfigOrThrow($val); |
193 | - $worker = new $cfg[ RB::KEY_HANDLER ](); |
|
193 | + $worker = new $cfg[RB::KEY_HANDLER](); |
|
194 | 194 | $converted_data = $worker->convert($val, $cfg); |
195 | - $data[ $key ] = $converted_data; |
|
195 | + $data[$key] = $converted_data; |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 |
@@ -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( |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | if (\is_array($m_val)) { |
51 | - $array[ $m_key ] = static::mergeConfig($original[ $m_key ], $m_val); |
|
51 | + $array[$m_key] = static::mergeConfig($original[$m_key], $m_val); |
|
52 | 52 | } else { |
53 | - $array[ $m_key ] = $m_val; |
|
53 | + $array[$m_key] = $m_val; |
|
54 | 54 | } |
55 | 55 | } else { |
56 | - $array[ $m_key ] = $m_val; |
|
56 | + $array[$m_key] = $m_val; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 |