@@ -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 | ]; |
@@ -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. |
@@ -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 | |
@@ -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 | } |
@@ -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; |
@@ -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 | } |