@@ -45,7 +45,7 @@ |
||
| 45 | 45 | ) |
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | - return array_map(function ($row, $key) use ($style, $length) { |
|
| 48 | + return array_map(function($row, $key) use ($style, $length) { |
|
| 49 | 49 | $text = $this->disabled ? $style->getDisabledItemText($row) : $row; |
| 50 | 50 | |
| 51 | 51 | if ($key === 0) { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | ) |
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | - return array_map(function ($row, $key) use ($style, $length) { |
|
| 63 | + return array_map(function($row, $key) use ($style, $length) { |
|
| 64 | 64 | $text = $this->disabled ? $style->getDisabledItemText($row) : $row; |
| 65 | 65 | |
| 66 | 66 | if ($key === 0) { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function getSelectAction() : ?callable |
| 85 | 85 | { |
| 86 | - return function (CliMenu $menu) { |
|
| 86 | + return function(CliMenu $menu) { |
|
| 87 | 87 | $this->showSubMenu($menu); |
| 88 | 88 | }; |
| 89 | 89 | } |
@@ -120,16 +120,16 @@ discard block |
||
| 120 | 120 | $largestItemExtra = $this->calculateItemExtra(); |
| 121 | 121 | |
| 122 | 122 | $length = $largestItemExtra > 0 |
| 123 | - ? floor($style->getContentWidth() / $numberOfItems) - ($largestItemExtra + 2) |
|
| 124 | - : floor($style->getContentWidth() / $numberOfItems); |
|
| 123 | + ? floor($style->getContentWidth()/$numberOfItems) - ($largestItemExtra + 2) |
|
| 124 | + : floor($style->getContentWidth()/$numberOfItems); |
|
| 125 | 125 | |
| 126 | 126 | $length -= $this->gutter; |
| 127 | 127 | $length = (int) $length; |
| 128 | 128 | |
| 129 | - $missingLength = $style->getContentWidth() % $numberOfItems; |
|
| 129 | + $missingLength = $style->getContentWidth()%$numberOfItems; |
|
| 130 | 130 | |
| 131 | 131 | return $this->buildRows( |
| 132 | - array_map(function ($index, $item) use ($selected, $length, $style) { |
|
| 132 | + array_map(function($index, $item) use ($selected, $length, $style) { |
|
| 133 | 133 | $isSelected = $selected && $index === $this->selectedItemIndex; |
| 134 | 134 | |
| 135 | 135 | if ($item instanceof CheckboxItem || $item instanceof RadioItem) { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $extraPadLength = $largestItemExtra > 0 ? 2 + $largestItemExtra : 0; |
| 178 | 178 | |
| 179 | 179 | return array_map( |
| 180 | - function ($i) use ($cells, $length, $missingLength, $extraPadLength) { |
|
| 180 | + function($i) use ($cells, $length, $missingLength, $extraPadLength) { |
|
| 181 | 181 | return $this->buildRow($cells, $i, $length, $missingLength, $extraPadLength); |
| 182 | 182 | }, |
| 183 | 183 | range(0, max(array_map('count', $cells)) - 1) |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | implode( |
| 192 | 192 | '', |
| 193 | 193 | array_map( |
| 194 | - function ($cell) use ($index, $length, $extraPadLength) { |
|
| 194 | + function($cell) use ($index, $length, $extraPadLength) { |
|
| 195 | 195 | return $cell[$index] ?? str_repeat(' ', $length + $this->gutter + $extraPadLength); |
| 196 | 196 | }, |
| 197 | 197 | $cells |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | bool $isSelected, |
| 209 | 209 | string $itemExtra |
| 210 | 210 | ) : array { |
| 211 | - return array_map(function ($row, $index) use ($length, $style, $isSelected, $itemExtra) { |
|
| 211 | + return array_map(function($row, $index) use ($length, $style, $isSelected, $itemExtra) { |
|
| 212 | 212 | $invertedColoursSetCode = $isSelected |
| 213 | 213 | ? $style->getInvertedColoursSetCode() |
| 214 | 214 | : ''; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | protected function calculateContentWidth() : void |
| 348 | 348 | { |
| 349 | 349 | $this->contentWidth = $this->width |
| 350 | - - ($this->paddingLeftRight * 2) |
|
| 350 | + - ($this->paddingLeftRight*2) |
|
| 351 | 351 | - ($this->borderRightWidth + $this->borderLeftWidth); |
| 352 | 352 | |
| 353 | 353 | if ($this->contentWidth < 0) { |
@@ -417,8 +417,8 @@ discard block |
||
| 417 | 417 | |
| 418 | 418 | private function maybeShrinkWidth(int $margin, int $width) : int |
| 419 | 419 | { |
| 420 | - if ($width + ($margin * 2) >= $this->terminal->getWidth()) { |
|
| 421 | - $width = $this->terminal->getWidth() - ($margin * 2); |
|
| 420 | + if ($width + ($margin*2) >= $this->terminal->getWidth()) { |
|
| 421 | + $width = $this->terminal->getWidth() - ($margin*2); |
|
| 422 | 422 | |
| 423 | 423 | if ($width <= 0) { |
| 424 | 424 | throw CannotShrinkMenuException::fromMarginAndTerminalWidth($margin, $this->terminal->getWidth()); |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | |
| 534 | 534 | private function calculateMarginAuto(int $width) : void |
| 535 | 535 | { |
| 536 | - $this->margin = (int) floor(($this->terminal->getWidth() - ($width)) / 2); |
|
| 536 | + $this->margin = (int) floor(($this->terminal->getWidth() - ($width))/2); |
|
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | public function setMargin(int $margin) : self |