@@ -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 | /** |
@@ -34,20 +34,20 @@ |
||
34 | 34 | $array = $original; |
35 | 35 | foreach ($merging as $m_key => $m_val) { |
36 | 36 | if (\array_key_exists($m_key, $original)) { |
37 | - $orig_type = \gettype($original[ $m_key ]); |
|
37 | + $orig_type = \gettype($original[$m_key]); |
|
38 | 38 | $m_type = \gettype($m_val); |
39 | 39 | if ($orig_type !== $m_type) { |
40 | 40 | throw new \RuntimeException( |
41 | 41 | "Incompatible types. Cannot merge {$m_type} into {$orig_type} (key '{$m_key}')."); |
42 | 42 | } |
43 | 43 | |
44 | - if (\is_array($merging[ $m_key ])) { |
|
45 | - $array[ $m_key ] = static::mergeConfig($original[ $m_key ], $m_val); |
|
44 | + if (\is_array($merging[$m_key])) { |
|
45 | + $array[$m_key] = static::mergeConfig($original[$m_key], $m_val); |
|
46 | 46 | } else { |
47 | - $array[ $m_key ] = $m_val; |
|
47 | + $array[$m_key] = $m_val; |
|
48 | 48 | } |
49 | 49 | } else { |
50 | - $array[ $m_key ] = $m_val; |
|
50 | + $array[$m_key] = $m_val; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | do { |
45 | 45 | if ($cfg === null) { |
46 | 46 | // Default handler MUST be present by design and always return something useful. |
47 | - $cfg = self::getExceptionHandlerConfig()[ ResponseBuilder::KEY_DEFAULT ]; |
|
47 | + $cfg = self::getExceptionHandlerConfig()[ResponseBuilder::KEY_DEFAULT]; |
|
48 | 48 | } |
49 | 49 | |
50 | - $handler = new $cfg[ ResponseBuilder::KEY_HANDLER ](); |
|
51 | - $handler_result = $handler->handle($cfg[ ResponseBuilder::KEY_CONFIG ], $ex); |
|
50 | + $handler = new $cfg[ResponseBuilder::KEY_HANDLER](); |
|
51 | + $handler_result = $handler->handle($cfg[ResponseBuilder::KEY_CONFIG], $ex); |
|
52 | 52 | if ($handler_result !== null) { |
53 | 53 | $result = self::processException($ex, $handler_result); |
54 | 54 | } else { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $cfg = self::getExceptionHandlerConfig(); |
148 | 148 | |
149 | 149 | // This config entry is guaranted to exist. Enforced by tests. |
150 | - $cfg = $cfg[ HttpException::class ][ ResponseBuilder::KEY_CONFIG ][ HttpResponse::HTTP_UNAUTHORIZED ]; |
|
150 | + $cfg = $cfg[HttpException::class][ResponseBuilder::KEY_CONFIG][HttpResponse::HTTP_UNAUTHORIZED]; |
|
151 | 151 | |
152 | 152 | return static::processException($exception, $cfg, HttpResponse::HTTP_UNAUTHORIZED); |
153 | 153 | } |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | |
281 | 281 | // check for exact class name match... |
282 | 282 | if (\array_key_exists($cls, $cfg)) { |
283 | - $result = $cfg[ $cls ]; |
|
283 | + $result = $cfg[$cls]; |
|
284 | 284 | } else { |
285 | 285 | // no exact match, then lets try with `instanceof` |
286 | 286 | // Config entries are already sorted by priority. |
287 | 287 | foreach (\array_keys($cfg) as $class_name) { |
288 | 288 | if ($ex instanceof $class_name) { |
289 | - $result = $cfg[ $class_name ]; |
|
289 | + $result = $cfg[$class_name]; |
|
290 | 290 | break; |
291 | 291 | } |
292 | 292 | } |
@@ -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 | ]; |
@@ -42,12 +42,12 @@ |
||
42 | 42 | $config = \array_replace($default_config, $user_config); |
43 | 43 | |
44 | 44 | $http_code = $ex->getStatusCode(); |
45 | - $result = $config[ $http_code ] ?? null; |
|
45 | + $result = $config[$http_code] ?? null; |
|
46 | 46 | |
47 | 47 | // If we do not have dedicated entry fort this particular http_code, |
48 | 48 | // fall back to default value. |
49 | 49 | if ($result === null) { |
50 | - $result = $config[ ResponseBuilder::KEY_DEFAULT ]; |
|
50 | + $result = $config[ResponseBuilder::KEY_DEFAULT]; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | // Some defaults to fall back to if not set in user config. |
@@ -374,7 +374,7 @@ |
||
374 | 374 | |
375 | 375 | if ($debug_data !== null) { |
376 | 376 | $debug_key = Config::get(ResponseBuilder::CONF_KEY_DEBUG_DEBUG_KEY, ResponseBuilder::KEY_DEBUG); |
377 | - $response[ $debug_key ] = $debug_data; |
|
377 | + $response[$debug_key] = $debug_data; |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | return $response; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $result = null; |
82 | 82 | |
83 | 83 | $type = \gettype($data); |
84 | - $result = $this->primitives[ $type ] ?? null; |
|
84 | + $result = $this->primitives[$type] ?? null; |
|
85 | 85 | if ($result === null) { |
86 | 86 | throw new \InvalidArgumentException(sprintf('No data conversion mapping configured for "%s" primitive.', $type)); |
87 | 87 | } |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | $cls = \get_class($data); |
114 | 114 | if (\is_string($cls)) { |
115 | 115 | if (\array_key_exists($cls, $this->classes)) { |
116 | - $result = $this->classes[ $cls ]; |
|
116 | + $result = $this->classes[$cls]; |
|
117 | 117 | $debug_result = 'exact config match'; |
118 | 118 | } else { |
119 | 119 | // no exact match, then lets try with `instanceof` |
120 | 120 | foreach (\array_keys($this->getClasses()) as $class_name) { |
121 | 121 | if ($data instanceof $class_name) { |
122 | - $result = $this->classes[ $class_name ]; |
|
122 | + $result = $this->classes[$class_name]; |
|
123 | 123 | $debug_result = "subclass of {$class_name}"; |
124 | 124 | break; |
125 | 125 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | // check for exact class name match... |
159 | 159 | if (\array_key_exists($cls, $this->classes)) { |
160 | - $result = $this->classes[ $cls ]; |
|
160 | + $result = $this->classes[$cls]; |
|
161 | 161 | $debug_result = 'exact config match'; |
162 | 162 | } |
163 | 163 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $key = null; |
196 | 196 | if (\is_object($data)) { |
197 | 197 | $cfg = $this->getClassMappingConfigOrThrow($data); |
198 | - $worker = new $cfg[ ResponseBuilder::KEY_HANDLER ](); |
|
198 | + $worker = new $cfg[ResponseBuilder::KEY_HANDLER](); |
|
199 | 199 | |
200 | 200 | } |
201 | 201 | |
@@ -234,22 +234,22 @@ discard block |
||
234 | 234 | |
235 | 235 | if ($result === null && \is_object($data)) { |
236 | 236 | $cfg = $this->getClassMappingConfigOrThrow($data); |
237 | - $worker = new $cfg[ ResponseBuilder::KEY_HANDLER ](); |
|
238 | - $result = [$cfg[ ResponseBuilder::KEY_KEY ] => $worker->convert($data, $cfg)]; |
|
237 | + $worker = new $cfg[ResponseBuilder::KEY_HANDLER](); |
|
238 | + $result = [$cfg[ResponseBuilder::KEY_KEY] => $worker->convert($data, $cfg)]; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | if ($result === null && \is_array($data)) { |
242 | 242 | $cfg = $this->getPrimitiveMappingConfigOrThrow($data); |
243 | 243 | |
244 | - if ($this->hasNonNumericKeys($data)){ |
|
244 | + if ($this->hasNonNumericKeys($data)) { |
|
245 | 245 | $result = $this->convertArray($data); |
246 | 246 | } else { |
247 | - $result = [$cfg[ ResponseBuilder::KEY_KEY ] => $this->convertArray($data)]; |
|
247 | + $result = [$cfg[ResponseBuilder::KEY_KEY] => $this->convertArray($data)]; |
|
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
251 | - if ( \is_bool($data) || \is_float($data) || \is_int($data) || \is_string($data)) { |
|
252 | - $result = [$this->getPrimitiveMappingConfigOrThrow($data)[ ResponseBuilder::KEY_KEY ] => $data]; |
|
251 | + if (\is_bool($data) || \is_float($data) || \is_int($data) || \is_string($data)) { |
|
252 | + $result = [$this->getPrimitiveMappingConfigOrThrow($data)[ResponseBuilder::KEY_KEY] => $data]; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | return $result; |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | |
300 | 300 | foreach ($data as $key => $val) { |
301 | 301 | if (\is_array($val)) { |
302 | - $data[ $key ] = $this->convertArray($val); |
|
302 | + $data[$key] = $this->convertArray($val); |
|
303 | 303 | } elseif (\is_object($val)) { |
304 | 304 | $cfg = $this->getClassMappingConfigOrThrow($val); |
305 | - $worker = new $cfg[ ResponseBuilder::KEY_HANDLER ](); |
|
305 | + $worker = new $cfg[ResponseBuilder::KEY_HANDLER](); |
|
306 | 306 | $converted_data = $worker->convert($val, $cfg); |
307 | - $data[ $key ] = $converted_data; |
|
307 | + $data[$key] = $converted_data; |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 |