Completed
Pull Request — master (#127)
by Aydin
02:05
created
src/CliMenu.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                     : $this->selectedItem++;
284 284
 
285 285
                 if (!array_key_exists($this->selectedItem, $this->items)) {
286
-                    $this->selectedItem  = $direction === 'UP'
286
+                    $this->selectedItem = $direction === 'UP'
287 287
                         ? end($itemKeys)
288 288
                         : reset($itemKeys);
289 289
                 } elseif ($this->getSelectedItem()->canSelect()) {
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
             $frame->addRows($this->drawMenuItem(new LineBreakItem($this->style->getTitleSeparator())));
388 388
         }
389 389
 
390
-        array_map(function ($item, $index) use ($frame) {
390
+        array_map(function($item, $index) use ($frame) {
391 391
             $frame->addRows($this->drawMenuItem($item, $index === $this->selectedItem));
392 392
         }, $this->items, array_keys($this->items));
393 393
 
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
             $borderColour = '';
439 439
         }
440 440
 
441
-        return array_map(function ($row) use ($invertedColoursSetCode, $invertedColoursUnsetCode, $borderColour) {
441
+        return array_map(function($row) use ($invertedColoursSetCode, $invertedColoursUnsetCode, $borderColour) {
442 442
             return sprintf(
443 443
                 "%s%s%s%s%s%s%s%s%s%s%s%s\n",
444 444
                 str_repeat(' ', $this->style->getMargin()),
Please login to merge, or discard this patch.
examples/split-item.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@
 block discarded – undo
3 3
 use PhpSchool\CliMenu\CliMenu;
4 4
 use PhpSchool\CliMenu\CliMenuBuilder;
5 5
 
6
-require_once(__DIR__ . '/../vendor/autoload.php');
6
+require_once(__DIR__.'/../vendor/autoload.php');
7 7
 
8
-$itemCallable = function (CliMenu $menu) {
8
+$itemCallable = function(CliMenu $menu) {
9 9
     echo $menu->getSelectedItem()->getText();
10 10
 };
11 11
 
Please login to merge, or discard this patch.
src/BuilderUtils.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public function addSubMenu(string $name, CliMenuBuilder $subMenuBuilder = null) : self
66 66
     {
67
-        $this->menuItems[]  = $id = 'submenu-placeholder-' . $name;
67
+        $this->menuItems[] = $id = 'submenu-placeholder-'.$name;
68 68
 
69 69
         if (null === $subMenuBuilder) {
70 70
             $this->subMenuBuilders[$id] = new CliMenuBuilder($this);
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
     private function buildSubMenus(array $items) : array
79 79
     {
80
-        return array_map(function ($item) {
80
+        return array_map(function($item) {
81 81
             if (!is_string($item) || 0 !== strpos($item, 'submenu-placeholder-')) {
82 82
                 return $item;
83 83
             }
Please login to merge, or discard this patch.
src/CliMenuBuilder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 
370 370
     private function itemsHaveExtra(array $items) : bool
371 371
     {
372
-        return !empty(array_filter($items, function (MenuItemInterface $item) {
372
+        return !empty(array_filter($items, function(MenuItemInterface $item) {
373 373
             return $item->showsItemExtra();
374 374
         }));
375 375
     }
@@ -424,12 +424,12 @@  discard block
 block discarded – undo
424 424
             throw new RuntimeException(sprintf('Menu: "%s" cannot be retrieved until menu has been built', $id));
425 425
         }
426 426
 
427
-        return $this->subMenus['submenu-placeholder-' . $id];
427
+        return $this->subMenus['submenu-placeholder-'.$id];
428 428
     }
429 429
     
430 430
     private function buildSplitItems(array $items) : array
431 431
     {
432
-        return array_map(function ($item) {
432
+        return array_map(function($item) {
433 433
             if (!is_string($item) || 0 !== strpos($item, 'splititem-placeholder-')) {
434 434
                 return $item;
435 435
             }
Please login to merge, or discard this patch.
src/MenuItem/SplitItem.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
         }
106 106
 
107 107
         $length = $style->getDisplaysExtra()
108
-            ? floor(($style->getContentWidth() - mb_strlen($style->getItemExtra()) + 2) / $numberOfItems)
109
-            : floor($style->getContentWidth() / $numberOfItems);
108
+            ? floor(($style->getContentWidth() - mb_strlen($style->getItemExtra()) + 2)/$numberOfItems)
109
+            : floor($style->getContentWidth()/$numberOfItems);
110 110
             
111 111
         $length -= $this->margin;
112 112
         
113
-        $missingLength = $style->getContentWidth() % $numberOfItems;
113
+        $missingLength = $style->getContentWidth()%$numberOfItems;
114 114
 
115 115
         $lines = 0;
116 116
         $cells = [];
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                 sprintf('%s%s', $marker, $item->getText()),
122 122
                 $length
123 123
             );
124
-            $cell = array_map(function ($row) use ($length, $style, $isSelected) {
124
+            $cell = array_map(function($row) use ($length, $style, $isSelected) {
125 125
                 $invertedColoursSetCode = $isSelected
126 126
                     ? $style->getInvertedColoursSetCode()
127 127
                     : '';
Please login to merge, or discard this patch.