Passed
Push — master ( 8395f6...b57eb2 )
by Bruno
05:20
created
Modelarium/Frontend/FrontendGenerator.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 
91 91
         if ($vue !== null) {
92 92
             $vueCode = $vue->getVueCode();
93
-            $cardFieldNames = array_map(function (Field $f) {
93
+            $cardFieldNames = array_map(function(Field $f) {
94 94
                 return $f->getName();
95 95
             }, $this->cardFields);
96
-            $tableFieldNames = array_map(function (Field $f) {
96
+            $tableFieldNames = array_map(function(Field $f) {
97 97
                 return $f->getName();
98 98
             }, $this->tableFields);
99 99
 
@@ -214,12 +214,12 @@  discard block
 block discarded – undo
214 214
         $hasVue = $this->composer->getByName('Vue');
215 215
 
216 216
         $this->cardFields = $this->model->filterField(
217
-            function (Field $field) {
217
+            function(Field $field) {
218 218
                 return $field->getRenderable('card', false);
219 219
             }
220 220
         );
221 221
         $this->tableFields = $this->model->filterField(
222
-            function (Field $field) {
222
+            function(Field $field) {
223 223
                 return $field->getRenderable('table', false);
224 224
             }
225 225
         );
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                 Button::TYPE => 'a',
231 231
                 Button::ATTRIBUTES => [
232 232
                     'href' => "/{$this->lowerName}/edit"
233
-                ] + ($hasVue ? [ "v-if" => 'can.create' ]: []),
233
+                ] + ($hasVue ? ["v-if" => 'can.create'] : []),
234 234
             ]
235 235
         )->setContent(
236 236
             '<i class="fa fa-plus"></i> Add new',
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                 Button::TYPE => ($hasVue ? 'router-link' : 'a'),
245 245
                 Button::ATTRIBUTES => [
246 246
                     ':to' => "'/{$this->lowerName}/' + model.id + '/edit'"
247
-                ] + ($hasVue ? [ "v-if" => 'can.edit' ]: []),
247
+                ] + ($hasVue ? ["v-if" => 'can.edit'] : []),
248 248
             ]
249 249
         )->setContent(
250 250
             '<i class="fa fa-pencil"></i> Edit',
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
                 Button::ATTRIBUTES => [
261 261
                     'href' => '#',
262 262
                     '@click.prevent' => 'remove'
263
-                ] + ($hasVue ? [ "v-if" => 'can.delete' ]: []),
263
+                ] + ($hasVue ? ["v-if" => 'can.delete'] : []),
264 264
             ]
265 265
         )->setContent(
266 266
             '<i class="fa fa-trash"></i> Delete',
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
             'Table',
276 276
             [
277 277
                 Table::ROW_NAMES => array_map(
278
-                    function (Field $field) {
278
+                    function(Field $field) {
279 279
                         return $field->getRenderable(Renderable::LABEL, $field->getName());
280 280
                     },
281 281
                     $this->tableFields
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
             true
294 294
         );
295 295
         $titleFields = $this->model->filterField(
296
-            function (Field $field) {
296
+            function(Field $field) {
297 297
                 return $field->getRenderable('title', false);
298 298
             }
299 299
         );
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
             // TODO 'hasCan' => $this->model
318 318
             'spinner' => $spinner,
319 319
             'tablelist' => $table->getRenderHTML(),
320
-            'tableItemFields' => array_keys(array_map(function (Field $f) {
320
+            'tableItemFields' => array_keys(array_map(function(Field $f) {
321 321
                 return $f->getName();
322 322
             }, $this->tableFields)),
323 323
             'titleField' => array_key_first($titleFields) ?: 'id'
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 
367 367
         if ($mode == 'editable') {
368 368
             $vue->setEditableTemplate(
369
-                function (FrameworkVue $vue, array $data, Model $m) use ($stub) {
369
+                function(FrameworkVue $vue, array $data, Model $m) use ($stub) {
370 370
                     return $this->templateCallback($stub, $vue, $data, $m);
371 371
                 }
372 372
             );
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
             );
381 381
         } else {
382 382
             $vue->setViewableTemplate(
383
-                function (FrameworkVue $vue, array $data, Model $m) use ($stub) {
383
+                function(FrameworkVue $vue, array $data, Model $m) use ($stub) {
384 384
                     return $this->templateCallback($stub, $vue, $data, $m);
385 385
                 }
386 386
             );
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
          * card
409 409
          */
410 410
         $cardFieldNames = array_map(
411
-            function (Field $field) {
411
+            function(Field $field) {
412 412
                 return $field->getName();
413 413
             },
414 414
             $this->cardFields
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
          * table
445 445
          */
446 446
         $tableFieldNames = array_map(
447
-            function (Field $field) {
447
+            function(Field $field) {
448 448
                 return $field->getName();
449 449
             },
450 450
             $this->tableFields
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
          * item
481 481
          */
482 482
         $graphqlQuery = $this->model->mapFields(
483
-            function (Field $f) {
483
+            function(Field $f) {
484 484
                 return \Modelarium\Frontend\Util::fieldShow($f) ? $f->toGraphqlQuery() : null;
485 485
             }
486 486
         );
@@ -549,14 +549,14 @@  discard block
 block discarded – undo
549 549
         ];
550 550
 
551 551
         $import = array_map(
552
-            function ($i) use ($name) {
552
+            function($i) use ($name) {
553 553
                 return "import {$name}$i from './{$name}$i.vue';";
554 554
             },
555 555
             $items
556 556
         );
557 557
 
558 558
         $export = array_map(
559
-            function ($i) use ($name) {
559
+            function($i) use ($name) {
560 560
                 return "    {$name}$i,\n";
561 561
             },
562 562
             $items
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
                 $this->templateFile(
584 584
                     $this->stubDir . "/routes.mustache.js",
585 585
                     // TODO: document routeBase renderable parameter
586
-                    [ 'routeName' => $this->model->getRenderable('routeBase', $this->lowerName) ]
586
+                    ['routeName' => $this->model->getRenderable('routeBase', $this->lowerName)]
587 587
                 ),
588 588
                 $path
589 589
             )
Please login to merge, or discard this patch.