Passed
Push — master ( b5e05b...1ff55b )
by Bruno
07:17
created
Modelarium/Frontend/FrontendGenerator.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
         if ($vue !== null) {
102 102
             // build the fields for cards and tables
103 103
             $vueCode = $vue->getVueCode();
104
-            $cardFieldNames = array_map(function (Field $f) {
104
+            $cardFieldNames = array_map(function(Field $f) {
105 105
                 return $f->getName();
106 106
             }, $this->cardFields);
107
-            $tableFieldNames = array_map(function (Field $f) {
107
+            $tableFieldNames = array_map(function(Field $f) {
108 108
                 return $f->getName();
109 109
             }, $this->tableFields);
110 110
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
                 $vue,
157 157
                 'Form',
158 158
                 'editable',
159
-                function (Field $f) {
159
+                function(Field $f) {
160 160
                     if (!$f->getExtradata('modelFillable')) {
161 161
                         return false;
162 162
                     }
@@ -226,12 +226,12 @@  discard block
 block discarded – undo
226 226
         $hasVue = $this->composer->getByName('Vue');
227 227
 
228 228
         $this->cardFields = $this->model->filterField(
229
-            function (Field $field) {
229
+            function(Field $field) {
230 230
                 return $field->getRenderable('card', false);
231 231
             }
232 232
         );
233 233
         $this->tableFields = $this->model->filterField(
234
-            function (Field $field) {
234
+            function(Field $field) {
235 235
                 return $field->getRenderable('table', false);
236 236
             }
237 237
         );
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                 Button::TYPE => 'a',
243 243
                 Button::ATTRIBUTES => [
244 244
                     'href' => "/{$this->lowerName}/edit"
245
-                ] + ($hasVue ? [ "v-if" => 'can.create' ]: []),
245
+                ] + ($hasVue ? ["v-if" => 'can.create'] : []),
246 246
             ]
247 247
         )->setContent(
248 248
             '<i class="fa fa-plus"></i> Add new',
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
                 Button::TYPE => ($hasVue ? 'router-link' : 'a'),
257 257
                 Button::ATTRIBUTES => [
258 258
                     ':to' => "'/{$this->lowerName}/' + model.id + '/edit'"
259
-                ] + ($hasVue ? [ "v-if" => 'can.edit' ]: []),
259
+                ] + ($hasVue ? ["v-if" => 'can.edit'] : []),
260 260
             ]
261 261
         )->setContent(
262 262
             '<i class="fa fa-pencil"></i> Edit',
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
                 Button::ATTRIBUTES => [
273 273
                     'href' => '#',
274 274
                     '@click.prevent' => 'remove'
275
-                ] + ($hasVue ? [ "v-if" => 'can.delete' ]: []),
275
+                ] + ($hasVue ? ["v-if" => 'can.delete'] : []),
276 276
             ]
277 277
         )->setContent(
278 278
             '<i class="fa fa-trash"></i> Delete',
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             'Table',
288 288
             [
289 289
                 Table::ROW_NAMES => array_map(
290
-                    function (Field $field) {
290
+                    function(Field $field) {
291 291
                         return $field->getRenderable(Renderable::LABEL, $field->getName());
292 292
                     },
293 293
                     $this->tableFields
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
             true
306 306
         );
307 307
         $titleFields = $this->model->filterField(
308
-            function (Field $field) {
308
+            function(Field $field) {
309 309
                 return $field->getRenderable('title', false);
310 310
             }
311 311
         );
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
             // TODO 'hasCan' => $this->model
331 331
             'spinner' => $spinner,
332 332
             'tablelist' => $table->getRenderHTML(),
333
-            'tableItemFields' => array_keys(array_map(function (Field $f) {
333
+            'tableItemFields' => array_keys(array_map(function(Field $f) {
334 334
                 return $f->getName();
335 335
             }, $this->tableFields)),
336 336
             'titleField' => array_key_first($titleFields) ?: 'id'
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 
380 380
         if ($mode == 'editable') {
381 381
             $vue->setEditableTemplate(
382
-                function (FrameworkVue $vue, array $data, Model $m) use ($stub) {
382
+                function(FrameworkVue $vue, array $data, Model $m) use ($stub) {
383 383
                     return $this->templateCallback($stub, $vue, $data, $m);
384 384
                 }
385 385
             );
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
             );
394 394
         } else {
395 395
             $vue->setViewableTemplate(
396
-                function (FrameworkVue $vue, array $data, Model $m) use ($stub) {
396
+                function(FrameworkVue $vue, array $data, Model $m) use ($stub) {
397 397
                     return $this->templateCallback($stub, $vue, $data, $m);
398 398
                 }
399 399
             );
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
          * card
468 468
          */
469 469
         $cardFieldNames = array_map(
470
-            function (Field $field) {
470
+            function(Field $field) {
471 471
                 return $field->getName();
472 472
             },
473 473
             $this->cardFields
@@ -480,8 +480,8 @@  discard block
 block discarded – undo
480 480
             $filtersQuery = ', ' . join(
481 481
                 ', ',
482 482
                 array_map(
483
-                    function ($item) {
484
-                        return '$' . $item['name']  . ': ' . $item['type'] . ($item['required'] ? '!' : '');
483
+                    function($item) {
484
+                        return '$' . $item['name'] . ': ' . $item['type'] . ($item['required'] ? '!' : '');
485 485
                     },
486 486
                     $filters
487 487
                 )
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
             $filtersParams = ', ' . join(
490 490
                 ', ',
491 491
                 array_map(
492
-                    function ($item) {
492
+                    function($item) {
493 493
                         return $item['name'] . ': $' . $item['name'];
494 494
                     },
495 495
                     $filters
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
          * table
529 529
          */
530 530
         $tableFieldNames = array_map(
531
-            function (Field $field) {
531
+            function(Field $field) {
532 532
                 return $field->getName();
533 533
             },
534 534
             $this->tableFields
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
          * item
565 565
          */
566 566
         $graphqlQuery = $this->model->mapFields(
567
-            function (Field $f) {
567
+            function(Field $f) {
568 568
                 return \Modelarium\Frontend\Util::fieldShow($f) ? $f->toGraphqlQuery() : null;
569 569
             }
570 570
         );
@@ -633,14 +633,14 @@  discard block
 block discarded – undo
633 633
         ];
634 634
 
635 635
         $import = array_map(
636
-            function ($i) use ($name) {
636
+            function($i) use ($name) {
637 637
                 return "import {$name}$i from './{$name}$i.vue';";
638 638
             },
639 639
             $items
640 640
         );
641 641
 
642 642
         $export = array_map(
643
-            function ($i) use ($name) {
643
+            function($i) use ($name) {
644 644
                 return "    {$name}$i,\n";
645 645
             },
646 646
             $items
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
                 $this->templateFile(
668 668
                     $this->stubDir . "/routes.mustache.js",
669 669
                     // TODO: document routeBase renderable parameter
670
-                    [ 'routeName' => $this->model->getRenderable('routeBase', $this->lowerName) ]
670
+                    ['routeName' => $this->model->getRenderable('routeBase', $this->lowerName)]
671 671
                 ),
672 672
                 $path
673 673
             )
Please login to merge, or discard this patch.