Passed
Push — master ( c837ae...12c3ac )
by Iman
04:05
created
src/controllers/ApiController/ExecuteApi.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             }
69 69
             $this->show($result, $posts);
70 70
         } elseif (in_array($actionType, ['save_add', 'save_edit'])) {
71
-            $rowAssign = array_filter($input_validator, function ($column) use ($table) {
71
+            $rowAssign = array_filter($input_validator, function($column) use ($table) {
72 72
                 return Schema::hasColumn($table, $column);
73 73
             }, ARRAY_FILTER_USE_KEY);
74 74
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         list($orderByCol, $orderByVal) = explode(',', $orderBy);
124 124
 
125 125
         $rows = $data->orderby($orderByCol, $orderByVal)->get();
126
-        if (! $rows) {
126
+        if (!$rows) {
127 127
             $result = $this->makeResult(0, 'There is no data found !');
128 128
             $result['data'] = [];
129 129
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      */
162 162
     private function filterRows($data, $parameters, $posts, $table, $typeExcept)
163 163
     {
164
-        $data->where(function ($w) use ($parameters, $posts, $table, $typeExcept) {
164
+        $data->where(function($w) use ($parameters, $posts, $table, $typeExcept) {
165 165
             foreach ($parameters as $param) {
166 166
                 $name = $param['name'];
167 167
                 $type = $param['type'];
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
                     $row->$k = asset($v);
251 251
                 }
252 252
 
253
-                if (! in_array($k, $responsesFields)) {
253
+                if (!in_array($k, $responsesFields)) {
254 254
                     unset($row[$k]);
255 255
                 }
256 256
             }
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
                 $rows->$k = asset($v);
304 304
             }
305 305
 
306
-            if (! in_array($k, $responsesFields)) {
306
+            if (!in_array($k, $responsesFields)) {
307 307
                 unset($row[$k]);
308 308
             }
309 309
         }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
     {
358 358
         $result = $this->makeResult(1, 'success');
359 359
 
360
-        return array_merge($result, (array)$rows);
360
+        return array_merge($result, (array) $rows);
361 361
     }
362 362
 
363 363
     /**
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
      */
368 368
     private function applyLike($data, $search_in, $value)
369 369
     {
370
-        $data->where(function ($w) use ($search_in, $value) {
370
+        $data->where(function($w) use ($search_in, $value) {
371 371
             foreach ($search_in as $k => $field) {
372 372
                 $method = 'orWhere';
373 373
                 if ($k == 0) {
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
      */
389 389
     private function joinRelatedTables($table, $responsesFields, $name, $data, $nameTmp)
390 390
     {
391
-        if (! DbInspector::isForeignKey($name)) {
391
+        if (!DbInspector::isForeignKey($name)) {
392 392
             return $nameTmp;
393 393
         }
394 394
         $joinTable = DbInspector::getTableForeignKey($name);
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
     {
426 426
         $this->ctrl->hookValidate();
427 427
 
428
-        if (! $this->ctrl->validate) {
428
+        if (!$this->ctrl->validate) {
429 429
             return true;
430 430
         }  // hook have to return true
431 431
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
     private function doValidation($inputValidator, $dataValidation, $posts)
458 458
     {
459 459
         $validator = Validator::make($inputValidator, $dataValidation);
460
-        if (! $validator->fails()) {
460
+        if (!$validator->fails()) {
461 461
             return true;
462 462
         }
463 463
         $message = $validator->errors()->all();
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     {
479 479
         $row = $data->first();
480 480
 
481
-        if (! $row) {
481
+        if (!$row) {
482 482
             return $this->makeResult(0, 'There is no data found !');
483 483
         }
484 484
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
                 $this->passwordError($posts);
501 501
             }
502 502
 
503
-            if (! $required && $used && $value) {
503
+            if (!$required && $used && $value) {
504 504
                 $this->passwordError($posts);
505 505
             }
506 506
         }
@@ -516,11 +516,11 @@  discard block
 block discarded – undo
516 516
      */
517 517
     private function filterRedundantResp($responses)
518 518
     {
519
-        $responses = array_filter($responses, function ($resp) {
520
-            return ! ($resp['name'] == 'ref_id' || $resp['type'] == 'custom');
519
+        $responses = array_filter($responses, function($resp) {
520
+            return !($resp['name'] == 'ref_id' || $resp['type'] == 'custom');
521 521
         });
522 522
 
523
-        $responses = array_filter($responses, function ($resp) {
523
+        $responses = array_filter($responses, function($resp) {
524 524
             return (intval($resp['used']) != 0 || DbInspector::isForeignKey($resp['name']));
525 525
         });
526 526
 
@@ -535,15 +535,15 @@  discard block
 block discarded – undo
535 535
     private function validateParams($parameters, $table)
536 536
     {
537 537
         $posts = request()->all();
538
-        if (! $parameters) {
538
+        if (!$parameters) {
539 539
             return ['', ''];
540 540
         }
541 541
         $typeExcept = ['password', 'ref', 'base64_file', 'custom', 'search'];
542 542
         $inputValidator = [];
543 543
         $dataValidation = [];
544 544
 
545
-        $parameters = array_filter($parameters, function ($param){
546
-            return !(is_string($param['config'])&& !starts_with($param['config'], '*'));
545
+        $parameters = array_filter($parameters, function($param) {
546
+            return !(is_string($param['config']) && !starts_with($param['config'], '*'));
547 547
         });
548 548
 
549 549
         foreach ($parameters as $param) {
Please login to merge, or discard this patch.