@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | ) |
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | - return mapWithKeys($rows, function (int $key, string $row) use ($style, $length) { |
|
| 73 | + return mapWithKeys($rows, function(int $key, string $row) use ($style, $length) { |
|
| 74 | 74 | $text = $this->disabled ? $style->getDisabledItemText($row) : $row; |
| 75 | 75 | |
| 76 | 76 | if ($key === 0) { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function getSelectAction() : ?callable |
| 111 | 111 | { |
| 112 | - return function (CliMenu $menu) { |
|
| 112 | + return function(CliMenu $menu) { |
|
| 113 | 113 | $this->showSubMenu($menu); |
| 114 | 114 | }; |
| 115 | 115 | } |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | ) |
| 72 | 72 | ); |
| 73 | 73 | |
| 74 | - return mapWithKeys($rows, function (int $key, string $row) use ($style, $length) { |
|
| 74 | + return mapWithKeys($rows, function(int $key, string $row) use ($style, $length) { |
|
| 75 | 75 | $text = $this->disabled ? $style->getDisabledItemText($row) : $row; |
| 76 | 76 | |
| 77 | 77 | if ($key === 0) { |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | Assertion::inArray($position, [self::POSITION_CENTER, self::POSITION_RIGHT, self::POSITION_LEFT]); |
| 50 | 50 | |
| 51 | 51 | $this->setText($text); |
| 52 | - $this->position = $position; |
|
| 52 | + $this->position = $position; |
|
| 53 | 53 | $this->alternateText = $alt; |
| 54 | 54 | |
| 55 | 55 | $this->style = new DefaultStyle(); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | $padding = $style->getContentWidth() - $this->artLength; |
| 69 | 69 | |
| 70 | - return array_map(function ($row) use ($padding) { |
|
| 70 | + return array_map(function($row) use ($padding) { |
|
| 71 | 71 | switch ($this->position) { |
| 72 | 72 | case self::POSITION_LEFT: |
| 73 | 73 | break; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | break; |
| 77 | 77 | case self::POSITION_CENTER: |
| 78 | 78 | default: |
| 79 | - $left = (int) ceil($padding / 2); |
|
| 79 | + $left = (int) ceil($padding/2); |
|
| 80 | 80 | $row = sprintf('%s%s', str_repeat(' ', $left), $row); |
| 81 | 81 | break; |
| 82 | 82 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function setText(string $text) : void |
| 116 | 116 | { |
| 117 | - $this->text = implode("\n", array_map(function (string $line) { |
|
| 117 | + $this->text = implode("\n", array_map(function(string $line) { |
|
| 118 | 118 | return rtrim($line, ' '); |
| 119 | 119 | }, explode("\n", $text))); |
| 120 | 120 | |
@@ -132,16 +132,16 @@ discard block |
||
| 132 | 132 | $largestItemExtra = $this->calculateItemExtra(); |
| 133 | 133 | |
| 134 | 134 | $length = $largestItemExtra > 0 |
| 135 | - ? floor($style->getContentWidth() / $numberOfItems) - ($largestItemExtra + 2) |
|
| 136 | - : floor($style->getContentWidth() / $numberOfItems); |
|
| 135 | + ? floor($style->getContentWidth()/$numberOfItems) - ($largestItemExtra + 2) |
|
| 136 | + : floor($style->getContentWidth()/$numberOfItems); |
|
| 137 | 137 | |
| 138 | 138 | $length -= $this->gutter; |
| 139 | 139 | $length = (int) $length; |
| 140 | 140 | |
| 141 | - $missingLength = $style->getContentWidth() % $numberOfItems; |
|
| 141 | + $missingLength = $style->getContentWidth()%$numberOfItems; |
|
| 142 | 142 | |
| 143 | 143 | return $this->buildRows( |
| 144 | - mapWithKeys($this->items, function (int $index, MenuItemInterface $item) use ($selected, $length, $style) { |
|
| 144 | + mapWithKeys($this->items, function(int $index, MenuItemInterface $item) use ($selected, $length, $style) { |
|
| 145 | 145 | $isSelected = $selected && $index === $this->selectedItemIndex; |
| 146 | 146 | |
| 147 | 147 | $marker = ''; |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $extraPadLength = $largestItemExtra > 0 ? 2 + $largestItemExtra : 0; |
| 184 | 184 | |
| 185 | 185 | return array_map( |
| 186 | - function ($i) use ($cells, $length, $missingLength, $extraPadLength) { |
|
| 186 | + function($i) use ($cells, $length, $missingLength, $extraPadLength) { |
|
| 187 | 187 | return $this->buildRow($cells, $i, $length, $missingLength, $extraPadLength); |
| 188 | 188 | }, |
| 189 | 189 | range(0, max(array_map('count', $cells)) - 1) |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | implode( |
| 198 | 198 | '', |
| 199 | 199 | array_map( |
| 200 | - function ($cell) use ($index, $length, $extraPadLength) { |
|
| 200 | + function($cell) use ($index, $length, $extraPadLength) { |
|
| 201 | 201 | return $cell[$index] ?? str_repeat(' ', $length + $this->gutter + $extraPadLength); |
| 202 | 202 | }, |
| 203 | 203 | $cells |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | bool $isSelected, |
| 215 | 215 | string $itemExtra |
| 216 | 216 | ) : array { |
| 217 | - return array_map(function ($row, $index) use ($length, $style, $isSelected, $itemExtra) { |
|
| 217 | + return array_map(function($row, $index) use ($length, $style, $isSelected, $itemExtra) { |
|
| 218 | 218 | $invertedColoursSetCode = $isSelected |
| 219 | 219 | ? $style->getInvertedColoursSetCode() |
| 220 | 220 | : ''; |
@@ -338,10 +338,10 @@ discard block |
||
| 338 | 338 | private function calculateItemExtra() : int |
| 339 | 339 | { |
| 340 | 340 | return max(array_map( |
| 341 | - function (MenuItemInterface $item) { |
|
| 341 | + function(MenuItemInterface $item) { |
|
| 342 | 342 | return mb_strlen($item->getStyle()->getItemExtra()); |
| 343 | 343 | }, |
| 344 | - array_filter($this->items, function (MenuItemInterface $item) { |
|
| 344 | + array_filter($this->items, function(MenuItemInterface $item) { |
|
| 345 | 345 | return $item->getStyle()->getDisplaysExtra(); |
| 346 | 346 | }) |
| 347 | 347 | )); |