Passed
Pull Request — master (#203)
by
unknown
02:08
created
src/MenuItem/ToggableTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
             )
49 49
         );
50 50
 
51
-        return array_map(function ($row, $key) use ($style, $length, $itemExtra) {
51
+        return array_map(function($row, $key) use ($style, $length, $itemExtra) {
52 52
             $text = $this->disabled ? $style->getDisabledItemText($row) : $row;
53 53
 
54 54
             if ($key === 0) {
Please login to merge, or discard this patch.
src/MenuItem/SplitItem.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -143,16 +143,16 @@  discard block
 block discarded – undo
143 143
         }
144 144
 
145 145
         $length = $this->style->getDisplaysExtra()
146
-            ? floor($style->getContentWidth() / $numberOfItems) - (mb_strlen($this->style->getItemExtra()) + 2)
147
-            : floor($style->getContentWidth() / $numberOfItems);
146
+            ? floor($style->getContentWidth()/$numberOfItems) - (mb_strlen($this->style->getItemExtra()) + 2)
147
+            : floor($style->getContentWidth()/$numberOfItems);
148 148
         
149 149
         $length -= $this->gutter;
150 150
         $length = (int) $length;
151 151
         
152
-        $missingLength = $style->getContentWidth() % $numberOfItems;
152
+        $missingLength = $style->getContentWidth()%$numberOfItems;
153 153
         
154 154
         return $this->buildRows(
155
-            array_map(function ($index, $item) use ($selected, $length, $style) {
155
+            array_map(function($index, $item) use ($selected, $length, $style) {
156 156
                 /** @var ItemStyleInterface|MenuItemInterface $item */
157 157
                 $isSelected = $selected && $index === $this->selectedItemIndex;
158 158
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         $extraPadLength = $this->style->getDisplaysExtra() ? 2 + mb_strlen($this->style->getItemExtra()) : 0;
201 201
         
202 202
         return array_map(
203
-            function ($i) use ($cells, $length, $missingLength, $extraPadLength) {
203
+            function($i) use ($cells, $length, $missingLength, $extraPadLength) {
204 204
                 return $this->buildRow($cells, $i, $length, $missingLength, $extraPadLength);
205 205
             },
206 206
             range(0, max(array_map('count', $cells)) - 1)
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
             implode(
215 215
                 '',
216 216
                 array_map(
217
-                    function ($cell) use ($index, $length, $extraPadLength) {
217
+                    function($cell) use ($index, $length, $extraPadLength) {
218 218
                         return $cell[$index] ?? str_repeat(' ', $length + $this->gutter + $extraPadLength);
219 219
                     },
220 220
                     $cells
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         bool $isSelected,
232 232
         string $itemExtra
233 233
     ) : array {
234
-        return array_map(function ($row, $index) use ($length, $style, $isSelected, $itemExtra) {
234
+        return array_map(function($row, $index) use ($length, $style, $isSelected, $itemExtra) {
235 235
             $invertedColoursSetCode = $isSelected
236 236
                 ? $style->getInvertedColoursSetCode()
237 237
                 : '';
Please login to merge, or discard this patch.
src/Builder/SplitItemBuilder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -232,28 +232,28 @@
 block discarded – undo
232 232
      */
233 233
     protected function createMenuClosure(CliMenuBuilder $builder) : Closure
234 234
     {
235
-        return function () use ($builder) {
235
+        return function() use ($builder) {
236 236
             $menu = $builder->build();
237 237
 
238 238
             $menu->setParent($this->menu);
239 239
 
240 240
             // If user changed this style, persist to the menu so children CheckableItems may use it
241 241
             if ($this->menu->getCheckableStyle()->getIsCustom()) {
242
-                $menu->checkableStyle(function (CheckableStyle $style) {
242
+                $menu->checkableStyle(function(CheckableStyle $style) {
243 243
                     $style->fromArray($this->menu->getCheckableStyle()->toArray());
244 244
                 });
245 245
             }
246 246
 
247 247
             // If user changed this style, persist to the menu so children RadioItems may use it
248 248
             if ($this->menu->getRadioStyle()->getIsCustom()) {
249
-                $menu->radioStyle(function (RadioStyle $style) {
249
+                $menu->radioStyle(function(RadioStyle $style) {
250 250
                     $style->fromArray($this->menu->getRadioStyle()->toArray());
251 251
                 });
252 252
             }
253 253
 
254 254
             // If user changed this style, persist to the menu so children SelectableItems may use it
255 255
             if ($this->menu->getSelectableStyle()->getIsCustom()) {
256
-                $menu->selectableStyle(function (SelectableStyle $style) {
256
+                $menu->selectableStyle(function(SelectableStyle $style) {
257 257
                     $style->fromArray($this->menu->getSelectableStyle()->toArray());
258 258
                 });
259 259
             }
Please login to merge, or discard this patch.
src/Builder/CliMenuBuilder.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     protected function createMenuClosure($builder) : Closure
238 238
     {
239
-        return function () use ($builder) {
239
+        return function() use ($builder) {
240 240
             $menu = $builder->build();
241 241
 
242 242
             $menu->setParent($this->menu);
@@ -247,15 +247,15 @@  discard block
 block discarded – undo
247 247
                 $menu->setStyle($this->menu->getStyle());
248 248
             }
249 249
 
250
-            $menu->checkableStyle(function (CheckableStyle $style) {
250
+            $menu->checkableStyle(function(CheckableStyle $style) {
251 251
                 $style->fromArray($this->menu->getCheckableStyle()->toArray());
252 252
             });
253 253
 
254
-            $menu->radioStyle(function (RadioStyle $style) {
254
+            $menu->radioStyle(function(RadioStyle $style) {
255 255
                 $style->fromArray($this->menu->getRadioStyle()->toArray());
256 256
             });
257 257
 
258
-            $menu->selectableStyle(function (SelectableStyle $style) {
258
+            $menu->selectableStyle(function(SelectableStyle $style) {
259 259
                 $style->fromArray($this->menu->getSelectableStyle()->toArray());
260 260
             });
261 261
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 
317 317
     private function processItemShortcut(MenuItemInterface $item) : void
318 318
     {
319
-        $this->processIndividualShortcut($item, function (CliMenu $menu) use ($item) {
319
+        $this->processIndividualShortcut($item, function(CliMenu $menu) use ($item) {
320 320
             $menu->executeAsSelected($item);
321 321
         });
322 322
     }
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     private function processSplitItemShortcuts(SplitItem $splitItem) : void
325 325
     {
326 326
         foreach ($splitItem->getItems() as $item) {
327
-            $this->processIndividualShortcut($item, function (CliMenu $menu) use ($splitItem, $item) {
327
+            $this->processIndividualShortcut($item, function(CliMenu $menu) use ($splitItem, $item) {
328 328
                 $current = $splitItem->getSelectedItemIndex();
329 329
 
330 330
                 $splitItem->setSelectedItemIndex(
@@ -362,22 +362,22 @@  discard block
 block discarded – undo
362 362
             $builder->enableAutoShortcuts($this->autoShortcutsRegex);
363 363
         }
364 364
 
365
-        $builder->checkableStyle(function (CheckableStyle $style) {
365
+        $builder->checkableStyle(function(CheckableStyle $style) {
366 366
             $style->fromArray($this->menu->getCheckableStyle()->toArray());
367 367
         });
368 368
 
369
-        $builder->radioStyle(function (RadioStyle $style) {
369
+        $builder->radioStyle(function(RadioStyle $style) {
370 370
             $style->fromArray($this->menu->getRadioStyle()->toArray());
371 371
         });
372 372
 
373
-        $builder->selectableStyle(function (SelectableStyle $style) {
373
+        $builder->selectableStyle(function(SelectableStyle $style) {
374 374
             $style->fromArray($this->menu->getSelectableStyle()->toArray());
375 375
         });
376 376
 
377 377
         $callback($builder);
378 378
 
379 379
         $splitItem = $builder->build();
380
-        $splitItem->setStyleCallback(function (SplitStyle $style) {
380
+        $splitItem->setStyleCallback(function(SplitStyle $style) {
381 381
             $style->fromArray($this->menu->getSelectableStyle()->toArray());
382 382
         });
383 383
 
@@ -483,10 +483,10 @@  discard block
 block discarded – undo
483 483
 
484 484
     public function setUnselectedMarker(string $marker) : self
485 485
     {
486
-        array_map(function (SelectableInterface $item) use ($marker) {
486
+        array_map(function(SelectableInterface $item) use ($marker) {
487 487
             $item->getStyle()
488 488
                 ->setMarkerOff($marker);
489
-        }, array_filter($this->menu->getItems(), function (MenuItemInterface $item) {
489
+        }, array_filter($this->menu->getItems(), function(MenuItemInterface $item) {
490 490
             return $item instanceof SelectableInterface;
491 491
         }));
492 492
 
@@ -498,10 +498,10 @@  discard block
 block discarded – undo
498 498
 
499 499
     public function setSelectedMarker(string $marker) : self
500 500
     {
501
-        array_map(function (SelectableInterface $item) use ($marker) {
501
+        array_map(function(SelectableInterface $item) use ($marker) {
502 502
             $item->getStyle()
503 503
                 ->setMarkerOn($marker);
504
-        }, array_filter($this->menu->getItems(), function (MenuItemInterface $item) {
504
+        }, array_filter($this->menu->getItems(), function(MenuItemInterface $item) {
505 505
             return $item instanceof SelectableInterface;
506 506
         }));
507 507
 
@@ -513,10 +513,10 @@  discard block
 block discarded – undo
513 513
 
514 514
     public function setItemExtra(string $extra) : self
515 515
     {
516
-        array_map(function (SelectableInterface $item) use ($extra) {
516
+        array_map(function(SelectableInterface $item) use ($extra) {
517 517
             $item->getStyle()
518 518
                 ->setItemExtra($extra);
519
-        }, array_filter($this->menu->getItems(), function (MenuItemInterface $item) {
519
+        }, array_filter($this->menu->getItems(), function(MenuItemInterface $item) {
520 520
             return $item instanceof SelectableInterface;
521 521
         }));
522 522
 
@@ -611,10 +611,10 @@  discard block
 block discarded – undo
611 611
 
612 612
     public function displayExtra() : self
613 613
     {
614
-        array_map(function (SelectableInterface $item) {
614
+        array_map(function(SelectableInterface $item) {
615 615
             $item->getStyle()
616 616
                 ->setDisplaysExtra(true);
617
-        }, array_filter($this->menu->getItems(), function (MenuItemInterface $item) {
617
+        }, array_filter($this->menu->getItems(), function(MenuItemInterface $item) {
618 618
             return $item instanceof SelectableInterface;
619 619
         }));
620 620
 
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 
627 627
     private function itemsHaveExtra(array $items) : bool
628 628
     {
629
-        return !empty(array_filter($items, function (MenuItemInterface $item) {
629
+        return !empty(array_filter($items, function(MenuItemInterface $item) {
630 630
             return $item->showsItemExtra();
631 631
         }));
632 632
     }
@@ -640,10 +640,10 @@  discard block
 block discarded – undo
640 640
         if (!$this->menu->getSelectableStyle()->getDisplaysExtra()) {
641 641
             $displaysExtra = $this->itemsHaveExtra($this->menu->getItems());
642 642
 
643
-            array_map(function (SelectableInterface $item) use ($displaysExtra) {
643
+            array_map(function(SelectableInterface $item) use ($displaysExtra) {
644 644
                 $item->getStyle()
645 645
                     ->setDisplaysExtra($displaysExtra);
646
-            }, array_filter($this->menu->getItems(), function (MenuItemInterface $item) {
646
+            }, array_filter($this->menu->getItems(), function(MenuItemInterface $item) {
647 647
                 return $item instanceof SelectableInterface;
648 648
             }));
649 649
         }
Please login to merge, or discard this patch.