@@ -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 |
@@ -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) { |