Passed
Pull Request — dev (#124)
by Marcin
04:38
created
src/ExceptionHandlerHelper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
             // Check if we have any exception configuration for this particular Http status code.
45 45
             // This confing entry is guaranted to exist (at least 'default'). Enforced by tests.
46 46
             $http_code = $ex->getStatusCode();
47
-            $ex_cfg = $cfg[ HttpException::class ][ $http_code ] ?? null;
48
-            $ex_cfg = $ex_cfg ?? $cfg[ HttpException::class ]['default'];
47
+            $ex_cfg = $cfg[HttpException::class][$http_code] ?? null;
48
+            $ex_cfg = $ex_cfg ?? $cfg[HttpException::class]['default'];
49 49
             $result = self::processException($ex, $ex_cfg, $http_code);
50 50
         } elseif ($ex instanceof ValidationException) {
51 51
             // This entry is guaranted to exist. Enforced by tests.
52 52
             $http_code = HttpResponse::HTTP_UNPROCESSABLE_ENTITY;
53
-            $ex_cfg = $cfg[ HttpException::class ][ $http_code ];
53
+            $ex_cfg = $cfg[HttpException::class][$http_code];
54 54
             $result = self::processException($ex, $ex_cfg, $http_code);
55 55
         }
56 56
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         $result = static::error($ex, $api_code, $http_code, $error_message);
97 97
 
98 98
         if ($result === null) {
99
-            $ex_cfg = $cfg[ HttpException::class ][ $http_code ];
99
+            $ex_cfg = $cfg[HttpException::class][$http_code];
100 100
             $api_code = $ex_cfg['api_code'] ?? BaseApiCodes::EX_VALIDATION_EXCEPTION();
101 101
             $http_code = $ex_cfg['http_code'] ?? $http_code;
102 102
             $result = static::error($ex, $api_code, $http_code, $error_message);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     {
145 145
         // This entry is guaranted to exist. Enforced by tests.
146 146
         $http_code = HttpResponse::HTTP_UNAUTHORIZED;
147
-        $cfg = static::getExceptionHandlerConfig()['map'][ HttpException::class ][ $http_code ];
147
+        $cfg = static::getExceptionHandlerConfig()['map'][HttpException::class][$http_code];
148 148
 
149 149
         return static::processException($exception, $cfg, $http_code);
150 150
     }
Please login to merge, or discard this patch.
src/Builder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
         $data = $converter->convert($data);
242 242
         if ($data !== null && !is_object($data)) {
243 243
             // ensure we get object in final JSON structure in data node
244
-            $data = (object)$data;
244
+            $data = (object) $data;
245 245
         }
246 246
 
247 247
         // get human readable message for API code or use message string (if given instead of API code)
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
         if ($debug_data !== null) {
265 265
             $debug_key = Config::get(ResponseBuilder::CONF_KEY_DEBUG_DEBUG_KEY, ResponseBuilder::KEY_DEBUG);
266
-            $response[ $debug_key ] = $debug_data;
266
+            $response[$debug_key] = $debug_data;
267 267
         }
268 268
 
269 269
         return $response;
Please login to merge, or discard this patch.
src/Converter.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
         // check for exact class name match...
67 67
         $cls = get_class($data);
68 68
         if (array_key_exists($cls, $this->classes)) {
69
-            $result = $this->classes[ $cls ];
69
+            $result = $this->classes[$cls];
70 70
         } else {
71 71
             // no exact match, then lets try with `instanceof`
72 72
             foreach (array_keys($this->getClasses()) as $class_name) {
73 73
                 if ($data instanceof $class_name) {
74
-                    $result = $this->classes[ $class_name ];
74
+                    $result = $this->classes[$class_name];
75 75
                     break;
76 76
                 }
77 77
             }
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
 
105 105
         if (is_object($data)) {
106 106
             $cfg = $this->getClassMappingConfigOrThrow($data);
107
-            $worker = new $cfg[ ResponseBuilder::KEY_HANDLER ]();
107
+            $worker = new $cfg[ResponseBuilder::KEY_HANDLER]();
108 108
             if (array_key_exists(ResponseBuilder::KEY_KEY, $cfg)) {
109
-                $data = [$cfg[ ResponseBuilder::KEY_KEY ] => $worker->convert($data, $cfg)];
109
+                $data = [$cfg[ResponseBuilder::KEY_KEY] => $worker->convert($data, $cfg)];
110 110
             } else {
111 111
                 $data = $worker->convert($data, $cfg);
112 112
             }
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
 
151 151
         foreach ($data as $key => $val) {
152 152
             if (is_array($val)) {
153
-                $data[ $key ] = $this->convertArray($val);
153
+                $data[$key] = $this->convertArray($val);
154 154
             } elseif (is_object($val)) {
155 155
                 $cls = get_class($val);
156 156
                 if (array_key_exists($cls, $this->classes)) {
157
-                    $cfg = $this->classes[ $cls ];
158
-                    $worker = new $cfg[ ResponseBuilder::KEY_HANDLER ]();
157
+                    $cfg = $this->classes[$cls];
158
+                    $worker = new $cfg[ResponseBuilder::KEY_HANDLER]();
159 159
                     $converted_data = $worker->convert($val, $cfg);
160
-                    $data[ $key ] = $converted_data;
160
+                    $data[$key] = $converted_data;
161 161
                 }
162 162
             }
163 163
         }
Please login to merge, or discard this patch.