Passed
Push — master ( b57eb2...b5e05b )
by Bruno
07:45
created
Modelarium/Frontend/FrontendGenerator.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 
88 88
         if ($vue !== null) {
89 89
             $vueCode = $vue->getVueCode();
90
-            $cardFieldNames = array_map(function (Field $f) {
90
+            $cardFieldNames = array_map(function(Field $f) {
91 91
                 return $f->getName();
92 92
             }, $this->cardFields);
93
-            $tableFieldNames = array_map(function (Field $f) {
93
+            $tableFieldNames = array_map(function(Field $f) {
94 94
                 return $f->getName();
95 95
             }, $this->tableFields);
96 96
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
                 $vue,
142 142
                 'Form',
143 143
                 'editable',
144
-                function (Field $f) {
144
+                function(Field $f) {
145 145
                     if (!$f->getExtradata('modelFillable')) {
146 146
                         return false;
147 147
                     }
@@ -211,12 +211,12 @@  discard block
 block discarded – undo
211 211
         $hasVue = $this->composer->getByName('Vue');
212 212
 
213 213
         $this->cardFields = $this->model->filterField(
214
-            function (Field $field) {
214
+            function(Field $field) {
215 215
                 return $field->getRenderable('card', false);
216 216
             }
217 217
         );
218 218
         $this->tableFields = $this->model->filterField(
219
-            function (Field $field) {
219
+            function(Field $field) {
220 220
                 return $field->getRenderable('table', false);
221 221
             }
222 222
         );
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
                 Button::TYPE => 'a',
228 228
                 Button::ATTRIBUTES => [
229 229
                     'href' => "/{$this->lowerName}/edit"
230
-                ] + ($hasVue ? [ "v-if" => 'can.create' ]: []),
230
+                ] + ($hasVue ? ["v-if" => 'can.create'] : []),
231 231
             ]
232 232
         )->setContent(
233 233
             '<i class="fa fa-plus"></i> Add new',
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
                 Button::TYPE => ($hasVue ? 'router-link' : 'a'),
242 242
                 Button::ATTRIBUTES => [
243 243
                     ':to' => "'/{$this->lowerName}/' + model.id + '/edit'"
244
-                ] + ($hasVue ? [ "v-if" => 'can.edit' ]: []),
244
+                ] + ($hasVue ? ["v-if" => 'can.edit'] : []),
245 245
             ]
246 246
         )->setContent(
247 247
             '<i class="fa fa-pencil"></i> Edit',
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
                 Button::ATTRIBUTES => [
258 258
                     'href' => '#',
259 259
                     '@click.prevent' => 'remove'
260
-                ] + ($hasVue ? [ "v-if" => 'can.delete' ]: []),
260
+                ] + ($hasVue ? ["v-if" => 'can.delete'] : []),
261 261
             ]
262 262
         )->setContent(
263 263
             '<i class="fa fa-trash"></i> Delete',
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             'Table',
273 273
             [
274 274
                 Table::ROW_NAMES => array_map(
275
-                    function (Field $field) {
275
+                    function(Field $field) {
276 276
                         return $field->getRenderable(Renderable::LABEL, $field->getName());
277 277
                     },
278 278
                     $this->tableFields
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
             true
291 291
         );
292 292
         $titleFields = $this->model->filterField(
293
-            function (Field $field) {
293
+            function(Field $field) {
294 294
                 return $field->getRenderable('title', false);
295 295
             }
296 296
         );
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
             // TODO 'hasCan' => $this->model
315 315
             'spinner' => $spinner,
316 316
             'tablelist' => $table->getRenderHTML(),
317
-            'tableItemFields' => array_keys(array_map(function (Field $f) {
317
+            'tableItemFields' => array_keys(array_map(function(Field $f) {
318 318
                 return $f->getName();
319 319
             }, $this->tableFields)),
320 320
             'titleField' => array_key_first($titleFields) ?: 'id'
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 
364 364
         if ($mode == 'editable') {
365 365
             $vue->setEditableTemplate(
366
-                function (FrameworkVue $vue, array $data, Model $m) use ($stub) {
366
+                function(FrameworkVue $vue, array $data, Model $m) use ($stub) {
367 367
                     return $this->templateCallback($stub, $vue, $data, $m);
368 368
                 }
369 369
             );
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
             );
378 378
         } else {
379 379
             $vue->setViewableTemplate(
380
-                function (FrameworkVue $vue, array $data, Model $m) use ($stub) {
380
+                function(FrameworkVue $vue, array $data, Model $m) use ($stub) {
381 381
                     return $this->templateCallback($stub, $vue, $data, $m);
382 382
                 }
383 383
             );
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
          * card
406 406
          */
407 407
         $cardFieldNames = array_map(
408
-            function (Field $field) {
408
+            function(Field $field) {
409 409
                 return $field->getName();
410 410
             },
411 411
             $this->cardFields
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
          * table
442 442
          */
443 443
         $tableFieldNames = array_map(
444
-            function (Field $field) {
444
+            function(Field $field) {
445 445
                 return $field->getName();
446 446
             },
447 447
             $this->tableFields
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
          * item
478 478
          */
479 479
         $graphqlQuery = $this->model->mapFields(
480
-            function (Field $f) {
480
+            function(Field $f) {
481 481
                 return \Modelarium\Frontend\Util::fieldShow($f) ? $f->toGraphqlQuery() : null;
482 482
             }
483 483
         );
@@ -546,14 +546,14 @@  discard block
 block discarded – undo
546 546
         ];
547 547
 
548 548
         $import = array_map(
549
-            function ($i) use ($name) {
549
+            function($i) use ($name) {
550 550
                 return "import {$name}$i from './{$name}$i.vue';";
551 551
             },
552 552
             $items
553 553
         );
554 554
 
555 555
         $export = array_map(
556
-            function ($i) use ($name) {
556
+            function($i) use ($name) {
557 557
                 return "    {$name}$i,\n";
558 558
             },
559 559
             $items
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
                 $this->templateFile(
581 581
                     $this->stubDir . "/routes.mustache.js",
582 582
                     // TODO: document routeBase renderable parameter
583
-                    [ 'routeName' => $this->model->getRenderable('routeBase', $this->lowerName) ]
583
+                    ['routeName' => $this->model->getRenderable('routeBase', $this->lowerName)]
584 584
                 ),
585 585
                 $path
586 586
             )
Please login to merge, or discard this patch.