Passed
Push — master ( 396998...e80d0c )
by Iman
05:38
created
src/controllers/ApiController/ExecuteApi.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                 $result = $this->handleDeleteAction($table, $data);
76 76
             }
77 77
         } elseif (in_array($actionType, ['save_add', 'save_edit'])) {
78
-            $rowAssign = array_filter($input_validator, function ($column) use ($table) {
78
+            $rowAssign = array_filter($input_validator, function($column) use ($table) {
79 79
                 return Schema::hasColumn($table, $column);
80 80
             }, ARRAY_FILTER_USE_KEY);
81 81
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         list($orderByCol, $orderByVal) = explode(',', $orderBy);
135 135
 
136 136
         $rows = $data->orderby($orderByCol, $orderByVal)->get();
137
-        if (! $rows) {
137
+        if (!$rows) {
138 138
             $result = $this->makeResult(0, 'There is no data found !');
139 139
             $result['data'] = [];
140 140
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      */
174 174
     private function filterRows($data, $parameters, $posts, $table, $typeExcept)
175 175
     {
176
-        $data->where(function ($w) use ($parameters, $posts, $table, $typeExcept) {
176
+        $data->where(function($w) use ($parameters, $posts, $table, $typeExcept) {
177 177
             foreach ($parameters as $param) {
178 178
                 $name = $param['name'];
179 179
                 $type = $param['type'];
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                     $row->$k = asset($v);
263 263
                 }
264 264
 
265
-                if (! in_array($k, $responsesFields)) {
265
+                if (!in_array($k, $responsesFields)) {
266 266
                     unset($row[$k]);
267 267
                 }
268 268
             }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                 $rows->$k = asset($v);
316 316
             }
317 317
 
318
-            if (! in_array($k, $responsesFields)) {
318
+            if (!in_array($k, $responsesFields)) {
319 319
                 unset($row[$k]);
320 320
             }
321 321
         }
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     {
370 370
         $result = $this->makeResult(1, 'success');
371 371
 
372
-        return array_merge($result, (array)$rows);
372
+        return array_merge($result, (array) $rows);
373 373
     }
374 374
 
375 375
     /**
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
      */
380 380
     private function applyLike($data, $search_in, $value)
381 381
     {
382
-        $data->where(function ($w) use ($search_in, $value) {
382
+        $data->where(function($w) use ($search_in, $value) {
383 383
             foreach ($search_in as $k => $field) {
384 384
                 if ($k == 0) {
385 385
                     $w->where($field, "like", "%$value%");
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
      */
401 401
     private function joinRelatedTables($table, $responsesFields, $name, $data, $nameTmp)
402 402
     {
403
-        if (! DbInspector::isForeignKey($name)) {
403
+        if (!DbInspector::isForeignKey($name)) {
404 404
             return $nameTmp;
405 405
         }
406 406
         $joinTable = DbInspector::getTableForeignKey($name);
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
         $posts = request()->all();
441 441
         $this->ctrl->hookValidate($posts);
442 442
 
443
-        if (! $this->ctrl->validate) {
443
+        if (!$this->ctrl->validate) {
444 444
             return true;
445 445
         }  // hook have to return true
446 446
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
     private function doValidation($input_validator, $data_validation, $posts)
476 476
     {
477 477
         $validator = Validator::make($input_validator, $data_validation);
478
-        if (! $validator->fails()) {
478
+        if (!$validator->fails()) {
479 479
             return true;
480 480
         }
481 481
         $message = $validator->errors()->all();
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
     {
499 499
         $row = $data->first();
500 500
 
501
-        if (! $row) {
501
+        if (!$row) {
502 502
             return $this->makeResult(0, 'There is no data found !');
503 503
         }
504 504
 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
                 $this->passwordError($posts);
521 521
             }
522 522
 
523
-            if (! $required && $used && $value) {
523
+            if (!$required && $used && $value) {
524 524
                 $this->passwordError($posts);
525 525
             }
526 526
         }
@@ -536,11 +536,11 @@  discard block
 block discarded – undo
536 536
      */
537 537
     private function filterRedundantResp($responses)
538 538
     {
539
-        $responses = array_filter($responses, function ($resp) {
540
-            return ! ($resp['name'] == 'ref_id' || $resp['type'] == 'custom');
539
+        $responses = array_filter($responses, function($resp) {
540
+            return !($resp['name'] == 'ref_id' || $resp['type'] == 'custom');
541 541
         });
542 542
 
543
-        $responses = array_filter($responses, function ($resp) {
543
+        $responses = array_filter($responses, function($resp) {
544 544
             return (intval($resp['used']) != 0 || DbInspector::isForeignKey($resp['name']));
545 545
         });
546 546
 
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
     private function validateParams($parameters, $table)
557 557
     {
558 558
         $posts = request()->all();
559
-        if (! $parameters) {
559
+        if (!$parameters) {
560 560
             return ['', ''];
561 561
         }
562 562
         $typeExcept = ['password', 'ref', 'base64_file', 'custom', 'search'];
Please login to merge, or discard this patch.