Passed
Push — master ( 86e697...a2c098 )
by Henry
02:28
created
src/Controllers/RecordsRequestHandler.php 1 patch
Spacing   +7 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         if (static::peekPath() == 'json') {
38 38
             // check access for API response modes
39 39
             static::$responseMode = static::shiftPath();
40
-            if (in_array(static::$responseMode, ['json','jsonp'])) {
40
+            if (in_array(static::$responseMode, ['json', 'jsonp'])) {
41 41
                 if (!static::checkAPIAccess()) {
42 42
                     return static::throwAPIUnAuthorizedError();
43 43
                 }
@@ -51,8 +51,7 @@  discard block
 block discarded – undo
51 51
     public static function handleRecordsRequest($action = false)
52 52
     {
53 53
         switch ($action ? $action : $action = static::shiftPath()) {
54
-            case 'save':
55
-            {
54
+            case 'save' : {
56 55
                 return static::handleMultiSaveRequest();
57 56
             }
58 57
             
@@ -190,9 +189,7 @@  discard block
 block discarded – undo
190 189
         }
191 190
 
192 191
         switch ($action ? $action : $action = static::shiftPath()) {
193
-            case '':
194
-            case false:
195
-            {
192
+            case '' : case false : {
196 193
                 $className = static::$recordClass;
197 194
                 
198 195
                 return static::respond(static::getTemplateName($className::$singularNoun), [
@@ -280,7 +277,7 @@  discard block
 block discarded – undo
280 277
     {
281 278
         $className = static::$recordClass;
282 279
             
283
-        static::prepareResponseModeJSON(['POST','PUT']);
280
+        static::prepareResponseModeJSON(['POST', 'PUT']);
284 281
         
285 282
         if ($className::fieldExists(key($_REQUEST['data']))) {
286 283
             $_REQUEST['data'] = [$_REQUEST['data']];
@@ -352,7 +349,7 @@  discard block
 block discarded – undo
352 349
     {
353 350
         $className = static::$recordClass;
354 351
 
355
-        static::prepareResponseModeJSON(['POST','PUT','DELETE']);
352
+        static::prepareResponseModeJSON(['POST', 'PUT', 'DELETE']);
356 353
         
357 354
         if ($className::fieldExists(key($_REQUEST['data']))) {
358 355
             $_REQUEST['data'] = [$_REQUEST['data']];
@@ -414,7 +411,7 @@  discard block
 block discarded – undo
414 411
             return static::throwUnauthorizedError();
415 412
         }
416 413
 
417
-        if (in_array($_SERVER['REQUEST_METHOD'], ['POST','PUT'])) {
414
+        if (in_array($_SERVER['REQUEST_METHOD'], ['POST', 'PUT'])) {
418 415
             if (static::$responseMode == 'json') {
419 416
                 $_REQUEST = JSON::getRequestData();
420 417
                 if (is_array($_REQUEST['data'])) {
@@ -575,7 +572,7 @@  discard block
 block discarded – undo
575 572
 
576 573
     public static function getTemplateName($noun)
577 574
     {
578
-        return preg_replace_callback('/\s+([a-zA-Z])/', function ($matches) {
575
+        return preg_replace_callback('/\s+([a-zA-Z])/', function($matches) {
579 576
             return strtoupper($matches[1]);
580 577
         }, $noun);
581 578
     }
Please login to merge, or discard this patch.