Passed
Push — release ( cb0359...181435 )
by Henry
08:47 queued 05:24
created
src/Controllers/RecordsRequestHandler.php 1 patch
Spacing   +7 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             // check access for API response modes
66 66
             $this->responseBuilder = JsonBuilder::class;
67 67
 
68
-            if (in_array($this->responseBuilder, [JsonBuilder::class,JsonpBuilder::class])) {
68
+            if (in_array($this->responseBuilder, [JsonBuilder::class, JsonpBuilder::class])) {
69 69
                 if (!$this->checkAPIAccess()) {
70 70
                     return $this->throwAPIUnAuthorizedError();
71 71
                 }
@@ -78,8 +78,7 @@  discard block
 block discarded – undo
78 78
     public function handleRecordsRequest($action = false): ResponseInterface
79 79
     {
80 80
         switch ($action ? $action : $action = $this->shiftPath()) {
81
-            case 'save':
82
-                {
81
+            case 'save' : {
83 82
                     return $this->handleMultiSaveRequest();
84 83
                 }
85 84
 
@@ -220,9 +219,7 @@  discard block
 block discarded – undo
220 219
         }
221 220
 
222 221
         switch ($action ? $action : $action = $this->shiftPath()) {
223
-            case '':
224
-            case false:
225
-                {
222
+            case '' : case false : {
226 223
                     $className = static::$recordClass;
227 224
 
228 225
                     return $this->respond($this->getTemplateName($className::$singularNoun), [
@@ -310,7 +307,7 @@  discard block
 block discarded – undo
310 307
     {
311 308
         $className = static::$recordClass;
312 309
 
313
-        $this->prepareResponseModeJSON(['POST','PUT']);
310
+        $this->prepareResponseModeJSON(['POST', 'PUT']);
314 311
 
315 312
         if (!empty($_REQUEST['data'])) {
316 313
             if ($className::fieldExists(key($_REQUEST['data']))) {
@@ -385,7 +382,7 @@  discard block
 block discarded – undo
385 382
     {
386 383
         $className = static::$recordClass;
387 384
 
388
-        $this->prepareResponseModeJSON(['POST','PUT','DELETE']);
385
+        $this->prepareResponseModeJSON(['POST', 'PUT', 'DELETE']);
389 386
 
390 387
         if (!empty($_REQUEST['data'])) {
391 388
             if ($className::fieldExists(key($_REQUEST['data']))) {
@@ -449,7 +446,7 @@  discard block
 block discarded – undo
449 446
             return $this->throwUnauthorizedError();
450 447
         }
451 448
 
452
-        if (in_array($_SERVER['REQUEST_METHOD'], ['POST','PUT'])) {
449
+        if (in_array($_SERVER['REQUEST_METHOD'], ['POST', 'PUT'])) {
453 450
             if ($this->responseBuilder === JsonBuilder::class) {
454 451
                 $_REQUEST = JSON::getRequestData();
455 452
                 if (isset($_REQUEST['data']) && is_array($_REQUEST['data'])) {
@@ -599,7 +596,7 @@  discard block
 block discarded – undo
599 596
 
600 597
     public function getTemplateName($noun)
601 598
     {
602
-        return preg_replace_callback('/\s+([a-zA-Z])/', function ($matches) {
599
+        return preg_replace_callback('/\s+([a-zA-Z])/', function($matches) {
603 600
             return strtoupper($matches[1]);
604 601
         }, $noun);
605 602
     }
Please login to merge, or discard this patch.