Passed
Push — master ( a97140...2505f7 )
by Henry
02:02
created
src/Controllers/RecordsRequestHandler.php 2 patches
Spacing   +8 added lines, -11 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), [
@@ -279,7 +276,7 @@  discard block
 block discarded – undo
279 276
     {
280 277
         $className = static::$recordClass;
281 278
             
282
-        static::prepareResponseModeJSON(['POST','PUT']);
279
+        static::prepareResponseModeJSON(['POST', 'PUT']);
283 280
         
284 281
         if ($className::fieldExists(key($_REQUEST['data']))) {
285 282
             $_REQUEST['data'] = [$_REQUEST['data']];
@@ -353,7 +350,7 @@  discard block
 block discarded – undo
353 350
 
354 351
         $PrimaryKey = $className::getPrimaryKey();
355 352
 
356
-        static::prepareResponseModeJSON(['POST','PUT','DELETE']);
353
+        static::prepareResponseModeJSON(['POST', 'PUT', 'DELETE']);
357 354
         
358 355
         if ($className::fieldExists(key($_REQUEST['data']))) {
359 356
             $_REQUEST['data'] = [$_REQUEST['data']];
@@ -375,7 +372,7 @@  discard block
 block discarded – undo
375 372
             try {
376 373
                 $results[] = static::processDatumDestroy($datum);
377 374
             }    
378
-            catch(Exception $e) {
375
+            catch (Exception $e) {
379 376
                 $failed[] = [
380 377
                     'record' => $datum,
381 378
                     'errors' => $e->getMessage(),
@@ -416,7 +413,7 @@  discard block
 block discarded – undo
416 413
             return static::throwUnauthorizedError();
417 414
         }
418 415
 
419
-        if (in_array($_SERVER['REQUEST_METHOD'], ['POST','PUT'])) {
416
+        if (in_array($_SERVER['REQUEST_METHOD'], ['POST', 'PUT'])) {
420 417
             if (static::$responseMode == 'json') {
421 418
                 $_REQUEST = JSON::getRequestData();
422 419
                 if (is_array($_REQUEST['data'])) {
@@ -577,7 +574,7 @@  discard block
 block discarded – undo
577 574
 
578 575
     public static function getTemplateName($noun)
579 576
     {
580
-        return preg_replace_callback('/\s+([a-zA-Z])/', function ($matches) {
577
+        return preg_replace_callback('/\s+([a-zA-Z])/', function($matches) {
581 578
             return strtoupper($matches[1]);
582 579
         }, $noun);
583 580
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -374,8 +374,7 @@
 block discarded – undo
374 374
         foreach ($_REQUEST['data'] as $datum) {
375 375
             try {
376 376
                 $results[] = static::processDatumDestroy($datum);
377
-            }    
378
-            catch(Exception $e) {
377
+            } catch(Exception $e) {
379 378
                 $failed[] = [
380 379
                     'record' => $datum,
381 380
                     'errors' => $e->getMessage(),
Please login to merge, or discard this patch.