@@ -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 CheckableItem) { |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $extraPadLength = $style->getDisplaysExtra() ? 2 + mb_strlen($style->getItemExtra()) : 0; |
| 176 | 176 | |
| 177 | 177 | return array_map( |
| 178 | - function ($i) use ($cells, $length, $missingLength, $extraPadLength) { |
|
| 178 | + function($i) use ($cells, $length, $missingLength, $extraPadLength) { |
|
| 179 | 179 | return $this->buildRow($cells, $i, $length, $missingLength, $extraPadLength); |
| 180 | 180 | }, |
| 181 | 181 | range(0, max(array_map('count', $cells)) - 1) |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | implode( |
| 190 | 190 | '', |
| 191 | 191 | array_map( |
| 192 | - function ($cell) use ($index, $length, $extraPadLength) { |
|
| 192 | + function($cell) use ($index, $length, $extraPadLength) { |
|
| 193 | 193 | return $cell[$index] ?? str_repeat(' ', $length + $this->gutter + $extraPadLength); |
| 194 | 194 | }, |
| 195 | 195 | $cells |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | bool $isSelected, |
| 207 | 207 | string $itemExtra |
| 208 | 208 | ) : array { |
| 209 | - return array_map(function ($row, $index) use ($length, $style, $isSelected, $itemExtra) { |
|
| 209 | + return array_map(function($row, $index) use ($length, $style, $isSelected, $itemExtra) { |
|
| 210 | 210 | $invertedColoursSetCode = $isSelected |
| 211 | 211 | ? $style->getInvertedColoursSetCode() |
| 212 | 212 | : ''; |
@@ -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 @@ |
||
| 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) { |
@@ -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 |
@@ -55,14 +55,14 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $filtered = array_filter( |
| 57 | 57 | $siblings, |
| 58 | - function (MenuItemInterface $item) { |
|
| 58 | + function(MenuItemInterface $item) { |
|
| 59 | 59 | return $item instanceof self; |
| 60 | 60 | } |
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | 63 | array_walk( |
| 64 | 64 | $filtered, |
| 65 | - function (RadioItem $checkableItem) { |
|
| 65 | + function(RadioItem $checkableItem) { |
|
| 66 | 66 | $checkableItem->setUnchecked(); |
| 67 | 67 | } |
| 68 | 68 | ); |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | private function processItemShortcut(MenuItemInterface $item) : void |
| 245 | 245 | { |
| 246 | - $this->processIndividualShortcut($item, function (CliMenu $menu) use ($item) { |
|
| 246 | + $this->processIndividualShortcut($item, function(CliMenu $menu) use ($item) { |
|
| 247 | 247 | $menu->executeAsSelected($item); |
| 248 | 248 | }); |
| 249 | 249 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | private function processSplitItemShortcuts(SplitItem $splitItem) : void |
| 252 | 252 | { |
| 253 | 253 | foreach ($splitItem->getItems() as $item) { |
| 254 | - $this->processIndividualShortcut($item, function (CliMenu $menu) use ($splitItem, $item) { |
|
| 254 | + $this->processIndividualShortcut($item, function(CliMenu $menu) use ($splitItem, $item) { |
|
| 255 | 255 | $current = $splitItem->getSelectedItemIndex(); |
| 256 | 256 | |
| 257 | 257 | $splitItem->setSelectedItemIndex( |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | |
| 530 | 530 | private function itemsHaveExtra(array $items) : bool |
| 531 | 531 | { |
| 532 | - return !empty(array_filter($items, function (MenuItemInterface $item) { |
|
| 532 | + return !empty(array_filter($items, function(MenuItemInterface $item) { |
|
| 533 | 533 | return $item->showsItemExtra(); |
| 534 | 534 | })); |
| 535 | 535 | } |
@@ -553,17 +553,17 @@ discard block |
||
| 553 | 553 | |
| 554 | 554 | private function propagateStyles(array $items) : void |
| 555 | 555 | { |
| 556 | - $menuItems = array_filter($items, function (MenuItemInterface $menuItem) { |
|
| 556 | + $menuItems = array_filter($items, function(MenuItemInterface $menuItem) { |
|
| 557 | 557 | return $menuItem instanceof MenuMenuItem; |
| 558 | 558 | }); |
| 559 | 559 | |
| 560 | - $changedMenus = array_filter($menuItems, function (MenuMenuItem $menuItem) { |
|
| 560 | + $changedMenus = array_filter($menuItems, function(MenuMenuItem $menuItem) { |
|
| 561 | 561 | return !$menuItem->getSubMenu() |
| 562 | 562 | ->getStyle() |
| 563 | 563 | ->hasChangedFromDefaults(); |
| 564 | 564 | }); |
| 565 | 565 | |
| 566 | - array_walk($changedMenus, function (MenuMenuItem $menuItem) { |
|
| 566 | + array_walk($changedMenus, function(MenuMenuItem $menuItem) { |
|
| 567 | 567 | $menuItem->getSubMenu()->setStyle( |
| 568 | 568 | $this->menu->getStyle() |
| 569 | 569 | ); |