Completed
Pull Request — master (#84)
by
unknown
01:53
created
src/CliMenuBuilder.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@
 block discarded – undo
9 9
 use PhpSchool\CliMenu\MenuItem\MenuItemInterface;
10 10
 use PhpSchool\CliMenu\MenuItem\MenuMenuItem;
11 11
 use PhpSchool\CliMenu\MenuItem\SelectableItem;
12
-use PhpSchool\CliMenu\MenuItem\SplitItem;
13 12
 use PhpSchool\CliMenu\MenuItem\StaticItem;
14 13
 use PhpSchool\CliMenu\Terminal\TerminalFactory;
15 14
 use Assert\Assertion;
Please login to merge, or discard this patch.
src/MenuItem/SplitItem.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
         }
57 57
 
58 58
         $length = $style->getDisplaysExtra()
59
-            ? floor(($style->getContentWidth() - mb_strlen($style->getItemExtra()) + 2) / $numberOfItems) - $this->margin
60
-            : floor($style->getContentWidth() / $numberOfItems) - $this->margin;
61
-        $missingLength = $style->getContentWidth() % $numberOfItems;
59
+            ? floor(($style->getContentWidth() - mb_strlen($style->getItemExtra()) + 2)/$numberOfItems) - $this->margin
60
+            : floor($style->getContentWidth()/$numberOfItems) - $this->margin;
61
+        $missingLength = $style->getContentWidth()%$numberOfItems;
62 62
 
63 63
         $lines = 0;
64 64
         $cells = [];
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
                 sprintf('%s%s', $marker, $item->getText()),
69 69
                 $length
70 70
             );
71
-            $cell = array_map(function ($row) use ($index, $length, $style) {
72
-                $row = $row . str_repeat(' ', $length - strlen($row));
71
+            $cell = array_map(function($row) use ($index, $length, $style) {
72
+                $row = $row.str_repeat(' ', $length - strlen($row));
73 73
                 if ($index === $this->selectedItemIndex) {
74
-                    $row = $style->getSelectedSetCode() . $row . $style->getSelectedUnsetCode();
74
+                    $row = $style->getSelectedSetCode().$row.$style->getSelectedUnsetCode();
75 75
                 } else {
76
-                    $row = $style->getUnselectedSetCode() . $row . $style->getUnselectedUnsetCode();
76
+                    $row = $style->getUnselectedSetCode().$row.$style->getUnselectedUnsetCode();
77 77
                 }
78
-                $row .= $style->getUnselectedSetCode() . str_repeat(' ', $this->margin);
78
+                $row .= $style->getUnselectedSetCode().str_repeat(' ', $this->margin);
79 79
                 return $row;
80 80
             }, explode("\n", $content));
81 81
             $lineCount = count($cell);
Please login to merge, or discard this patch.
src/CliMenu.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
                     : $this->selectedItem++;
211 211
 
212 212
                 if (!array_key_exists($this->selectedItem, $this->items)) {
213
-                    $this->selectedItem  = $direction === 'UP'
213
+                    $this->selectedItem = $direction === 'UP'
214 214
                         ? end($itemKeys)
215 215
                         : reset($itemKeys);
216 216
                 } elseif ($this->getSelectedItem()->canSelect()) {
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
             $frame->addRows($this->drawMenuItem(new LineBreakItem($this->style->getTitleSeparator())));
302 302
         }
303 303
 
304
-        array_map(function ($item, $index) use ($frame) {
304
+        array_map(function($item, $index) use ($frame) {
305 305
             $frame->addRows($this->drawMenuItem($item, $index === $this->selectedItem));
306 306
         }, $this->items, array_keys($this->items));
307 307
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             ? $this->style->getSelectedUnsetCode()
336 336
             : $this->style->getUnselectedUnsetCode();
337 337
 
338
-        return array_map(function ($row) use ($setColour, $unsetColour) {
338
+        return array_map(function($row) use ($setColour, $unsetColour) {
339 339
             return sprintf(
340 340
                 "%s%s%s%s%s%s%s\n",
341 341
                 str_repeat(' ', $this->style->getMargin()),
Please login to merge, or discard this patch.