@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | : $this->selectedItem++; |
| 312 | 312 | |
| 313 | 313 | if ($this->selectedItem !== null && !array_key_exists($this->selectedItem, $this->items)) { |
| 314 | - $this->selectedItem = $direction === 'UP' |
|
| 314 | + $this->selectedItem = $direction === 'UP' |
|
| 315 | 315 | ? (int) end($itemKeys) |
| 316 | 316 | : (int) reset($itemKeys); |
| 317 | 317 | } |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | $frame->addRows($this->drawMenuItem(new LineBreakItem($this->style->getTitleSeparator()))); |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | - array_map(function ($item, $index) use ($frame) { |
|
| 466 | + array_map(function($item, $index) use ($frame) { |
|
| 467 | 467 | $frame->addRows($this->drawMenuItem($item, $index === $this->selectedItem)); |
| 468 | 468 | }, $this->items, array_keys($this->items)); |
| 469 | 469 | |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | $borderColour = ''; |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - return array_map(function ($row) use ($invertedColoursSetCode, $invertedColoursUnsetCode, $borderColour) { |
|
| 517 | + return array_map(function($row) use ($invertedColoursSetCode, $invertedColoursUnsetCode, $borderColour) { |
|
| 518 | 518 | return sprintf( |
| 519 | 519 | "%s%s%s%s%s%s%s%s%s%s%s%s\n", |
| 520 | 520 | str_repeat(' ', $this->style->getMargin()), |
@@ -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) { |
@@ -118,16 +118,16 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | $length = $style->getDisplaysExtra() |
| 121 | - ? floor($style->getContentWidth() / $numberOfItems) - (mb_strlen($style->getItemExtra()) + 2) |
|
| 122 | - : floor($style->getContentWidth() / $numberOfItems); |
|
| 121 | + ? floor($style->getContentWidth()/$numberOfItems) - (mb_strlen($style->getItemExtra()) + 2) |
|
| 122 | + : floor($style->getContentWidth()/$numberOfItems); |
|
| 123 | 123 | |
| 124 | 124 | $length -= $this->gutter; |
| 125 | 125 | $length = (int) $length; |
| 126 | 126 | |
| 127 | - $missingLength = $style->getContentWidth() % $numberOfItems; |
|
| 127 | + $missingLength = $style->getContentWidth()%$numberOfItems; |
|
| 128 | 128 | |
| 129 | 129 | return $this->buildRows( |
| 130 | - array_map(function ($index, $item) use ($selected, $length, $style) { |
|
| 130 | + array_map(function($index, $item) use ($selected, $length, $style) { |
|
| 131 | 131 | $isSelected = $selected && $index === $this->selectedItemIndex; |
| 132 | 132 | |
| 133 | 133 | if ($item instanceof CheckboxItem) { |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $extraPadLength = $style->getDisplaysExtra() ? 2 + mb_strlen($style->getItemExtra()) : 0; |
| 180 | 180 | |
| 181 | 181 | return array_map( |
| 182 | - function ($i) use ($cells, $length, $missingLength, $extraPadLength) { |
|
| 182 | + function($i) use ($cells, $length, $missingLength, $extraPadLength) { |
|
| 183 | 183 | return $this->buildRow($cells, $i, $length, $missingLength, $extraPadLength); |
| 184 | 184 | }, |
| 185 | 185 | range(0, max(array_map('count', $cells)) - 1) |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | implode( |
| 194 | 194 | '', |
| 195 | 195 | array_map( |
| 196 | - function ($cell) use ($index, $length, $extraPadLength) { |
|
| 196 | + function($cell) use ($index, $length, $extraPadLength) { |
|
| 197 | 197 | return $cell[$index] ?? str_repeat(' ', $length + $this->gutter + $extraPadLength); |
| 198 | 198 | }, |
| 199 | 199 | $cells |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | bool $isSelected, |
| 211 | 211 | string $itemExtra |
| 212 | 212 | ) : array { |
| 213 | - return array_map(function ($row, $index) use ($length, $style, $isSelected, $itemExtra) { |
|
| 213 | + return array_map(function($row, $index) use ($length, $style, $isSelected, $itemExtra) { |
|
| 214 | 214 | $invertedColoursSetCode = $isSelected |
| 215 | 215 | ? $style->getInvertedColoursSetCode() |
| 216 | 216 | : ''; |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | */ |
| 46 | 46 | public function getSelectAction() : ?callable |
| 47 | 47 | { |
| 48 | - return function (CliMenu $cliMenu) { |
|
| 48 | + return function(CliMenu $cliMenu) { |
|
| 49 | 49 | $this->toggle(); |
| 50 | 50 | $cliMenu->redraw(); |
| 51 | 51 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function getSelectAction() : ?callable |
| 47 | 47 | { |
| 48 | - return function (CliMenu $cliMenu) { |
|
| 48 | + return function(CliMenu $cliMenu) { |
|
| 49 | 49 | $parentItem = $cliMenu->getItemByIndex($cliMenu->getSelectedItemIndex()); |
| 50 | 50 | |
| 51 | 51 | $siblings = $parentItem instanceof SplitItem |
@@ -54,14 +54,14 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | $filtered = array_filter( |
| 56 | 56 | $siblings, |
| 57 | - function (MenuItemInterface $item) { |
|
| 57 | + function(MenuItemInterface $item) { |
|
| 58 | 58 | return $item instanceof self; |
| 59 | 59 | } |
| 60 | 60 | ); |
| 61 | 61 | |
| 62 | 62 | array_walk( |
| 63 | 63 | $filtered, |
| 64 | - function (RadioItem $item) { |
|
| 64 | + function(RadioItem $item) { |
|
| 65 | 65 | $item->setUnchecked(); |
| 66 | 66 | } |
| 67 | 67 | ); |