@@ -202,28 +202,28 @@ |
||
| 202 | 202 | */ |
| 203 | 203 | protected function createMenuClosure(CliMenuBuilder $builder) : Closure |
| 204 | 204 | { |
| 205 | - return function () use ($builder) { |
|
| 205 | + return function() use ($builder) { |
|
| 206 | 206 | $menu = $builder->build(); |
| 207 | 207 | |
| 208 | 208 | $menu->setParent($this->menu); |
| 209 | 209 | |
| 210 | 210 | // If user changed this style, persist to the menu so children CheckableItems may use it |
| 211 | 211 | if ($this->menu->getCheckableStyle()->getIsCustom()) { |
| 212 | - $menu->setCheckableStyle(function (CheckableStyle $style) { |
|
| 212 | + $menu->setCheckableStyle(function(CheckableStyle $style) { |
|
| 213 | 213 | $style->fromArray($this->menu->getCheckableStyle()->toArray()); |
| 214 | 214 | }); |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | // If user changed this style, persist to the menu so children RadioItems may use it |
| 218 | 218 | if ($this->menu->getRadioStyle()->getIsCustom()) { |
| 219 | - $menu->setRadioStyle(function (RadioStyle $style) { |
|
| 219 | + $menu->setRadioStyle(function(RadioStyle $style) { |
|
| 220 | 220 | $style->fromArray($this->menu->getRadioStyle()->toArray()); |
| 221 | 221 | }); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | // If user changed this style, persist to the menu so children SelectableItems may use it |
| 225 | 225 | if ($this->menu->getSelectableStyle()->getIsCustom()) { |
| 226 | - $menu->setSelectableStyle(function (SelectableStyle $style) { |
|
| 226 | + $menu->setSelectableStyle(function(SelectableStyle $style) { |
|
| 227 | 227 | $style->fromArray($this->menu->getSelectableStyle()->toArray()); |
| 228 | 228 | }); |
| 229 | 229 | } |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | ) |
| 49 | 49 | ); |
| 50 | 50 | |
| 51 | - return array_map(function ($row, $key) use ($style, $length, $itemExtra) { |
|
| 51 | + return array_map(function($row, $key) use ($style, $length, $itemExtra) { |
|
| 52 | 52 | $text = $this->disabled ? $style->getDisabledItemText($row) : $row; |
| 53 | 53 | |
| 54 | 54 | if ($key === 0) { |
@@ -143,16 +143,16 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $length = $this->style->getDisplaysExtra() |
| 146 | - ? floor($style->getContentWidth() / $numberOfItems) - (mb_strlen($this->style->getItemExtra()) + 2) |
|
| 147 | - : floor($style->getContentWidth() / $numberOfItems); |
|
| 146 | + ? floor($style->getContentWidth()/$numberOfItems) - (mb_strlen($this->style->getItemExtra()) + 2) |
|
| 147 | + : floor($style->getContentWidth()/$numberOfItems); |
|
| 148 | 148 | |
| 149 | 149 | $length -= $this->gutter; |
| 150 | 150 | $length = (int) $length; |
| 151 | 151 | |
| 152 | - $missingLength = $style->getContentWidth() % $numberOfItems; |
|
| 152 | + $missingLength = $style->getContentWidth()%$numberOfItems; |
|
| 153 | 153 | |
| 154 | 154 | return $this->buildRows( |
| 155 | - array_map(function ($index, $item) use ($selected, $length, $style) { |
|
| 155 | + array_map(function($index, $item) use ($selected, $length, $style) { |
|
| 156 | 156 | /** @var ItemStyleInterface|MenuItemInterface $item */ |
| 157 | 157 | $isSelected = $selected && $index === $this->selectedItemIndex; |
| 158 | 158 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $extraPadLength = $this->style->getDisplaysExtra() ? 2 + mb_strlen($this->style->getItemExtra()) : 0; |
| 201 | 201 | |
| 202 | 202 | return array_map( |
| 203 | - function ($i) use ($cells, $length, $missingLength, $extraPadLength) { |
|
| 203 | + function($i) use ($cells, $length, $missingLength, $extraPadLength) { |
|
| 204 | 204 | return $this->buildRow($cells, $i, $length, $missingLength, $extraPadLength); |
| 205 | 205 | }, |
| 206 | 206 | range(0, max(array_map('count', $cells)) - 1) |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | implode( |
| 215 | 215 | '', |
| 216 | 216 | array_map( |
| 217 | - function ($cell) use ($index, $length, $extraPadLength) { |
|
| 217 | + function($cell) use ($index, $length, $extraPadLength) { |
|
| 218 | 218 | return $cell[$index] ?? str_repeat(' ', $length + $this->gutter + $extraPadLength); |
| 219 | 219 | }, |
| 220 | 220 | $cells |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | bool $isSelected, |
| 232 | 232 | string $itemExtra |
| 233 | 233 | ) : array { |
| 234 | - return array_map(function ($row, $index) use ($length, $style, $isSelected, $itemExtra) { |
|
| 234 | + return array_map(function($row, $index) use ($length, $style, $isSelected, $itemExtra) { |
|
| 235 | 235 | $invertedColoursSetCode = $isSelected |
| 236 | 236 | ? $style->getInvertedColoursSetCode() |
| 237 | 237 | : ''; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | protected function createMenuClosure($builder) : Closure |
| 238 | 238 | { |
| 239 | - return function () use ($builder) { |
|
| 239 | + return function() use ($builder) { |
|
| 240 | 240 | $menu = $builder->build(); |
| 241 | 241 | |
| 242 | 242 | $menu->setParent($this->menu); |
@@ -247,15 +247,15 @@ discard block |
||
| 247 | 247 | $menu->setStyle($this->menu->getStyle()); |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - $menu->setCheckableStyle(function (CheckableStyle $style) { |
|
| 250 | + $menu->setCheckableStyle(function(CheckableStyle $style) { |
|
| 251 | 251 | $style->fromArray($this->menu->getCheckableStyle()->toArray()); |
| 252 | 252 | }); |
| 253 | 253 | |
| 254 | - $menu->setRadioStyle(function (RadioStyle $style) { |
|
| 254 | + $menu->setRadioStyle(function(RadioStyle $style) { |
|
| 255 | 255 | $style->fromArray($this->menu->getRadioStyle()->toArray()); |
| 256 | 256 | }); |
| 257 | 257 | |
| 258 | - $menu->setSelectableStyle(function (SelectableStyle $style) { |
|
| 258 | + $menu->setSelectableStyle(function(SelectableStyle $style) { |
|
| 259 | 259 | $style->fromArray($this->menu->getSelectableStyle()->toArray()); |
| 260 | 260 | }); |
| 261 | 261 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | private function processItemShortcut(MenuItemInterface $item) : void |
| 318 | 318 | { |
| 319 | - $this->processIndividualShortcut($item, function (CliMenu $menu) use ($item) { |
|
| 319 | + $this->processIndividualShortcut($item, function(CliMenu $menu) use ($item) { |
|
| 320 | 320 | $menu->executeAsSelected($item); |
| 321 | 321 | }); |
| 322 | 322 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | private function processSplitItemShortcuts(SplitItem $splitItem) : void |
| 325 | 325 | { |
| 326 | 326 | foreach ($splitItem->getItems() as $item) { |
| 327 | - $this->processIndividualShortcut($item, function (CliMenu $menu) use ($splitItem, $item) { |
|
| 327 | + $this->processIndividualShortcut($item, function(CliMenu $menu) use ($splitItem, $item) { |
|
| 328 | 328 | $current = $splitItem->getSelectedItemIndex(); |
| 329 | 329 | |
| 330 | 330 | $splitItem->setSelectedItemIndex( |
@@ -362,22 +362,22 @@ discard block |
||
| 362 | 362 | $builder->enableAutoShortcuts($this->autoShortcutsRegex); |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - $builder->setCheckableStyle(function (CheckableStyle $style) { |
|
| 365 | + $builder->setCheckableStyle(function(CheckableStyle $style) { |
|
| 366 | 366 | $style->fromArray($this->menu->getCheckableStyle()->toArray()); |
| 367 | 367 | }); |
| 368 | 368 | |
| 369 | - $builder->setRadioStyle(function (RadioStyle $style) { |
|
| 369 | + $builder->setRadioStyle(function(RadioStyle $style) { |
|
| 370 | 370 | $style->fromArray($this->menu->getRadioStyle()->toArray()); |
| 371 | 371 | }); |
| 372 | 372 | |
| 373 | - $builder->setSelectableStyle(function (SelectableStyle $style) { |
|
| 373 | + $builder->setSelectableStyle(function(SelectableStyle $style) { |
|
| 374 | 374 | $style->fromArray($this->menu->getSelectableStyle()->toArray()); |
| 375 | 375 | }); |
| 376 | 376 | |
| 377 | 377 | $callback($builder); |
| 378 | 378 | |
| 379 | 379 | $splitItem = $builder->build(); |
| 380 | - $splitItem->setStyleCallback(function (SplitStyle $style) { |
|
| 380 | + $splitItem->setStyleCallback(function(SplitStyle $style) { |
|
| 381 | 381 | $style->fromArray($this->menu->getSelectableStyle()->toArray()); |
| 382 | 382 | }); |
| 383 | 383 | |
@@ -483,10 +483,10 @@ discard block |
||
| 483 | 483 | |
| 484 | 484 | public function setUnselectedMarker(string $marker) : self |
| 485 | 485 | { |
| 486 | - array_map(function (SelectableInterface $item) use ($marker) { |
|
| 486 | + array_map(function(SelectableInterface $item) use ($marker) { |
|
| 487 | 487 | $item->getStyle() |
| 488 | 488 | ->setMarkerOff($marker); |
| 489 | - }, array_filter($this->menu->getItems(), function (MenuItemInterface $item) { |
|
| 489 | + }, array_filter($this->menu->getItems(), function(MenuItemInterface $item) { |
|
| 490 | 490 | return $item instanceof SelectableInterface; |
| 491 | 491 | })); |
| 492 | 492 | |
@@ -498,10 +498,10 @@ discard block |
||
| 498 | 498 | |
| 499 | 499 | public function setSelectedMarker(string $marker) : self |
| 500 | 500 | { |
| 501 | - array_map(function (SelectableInterface $item) use ($marker) { |
|
| 501 | + array_map(function(SelectableInterface $item) use ($marker) { |
|
| 502 | 502 | $item->getStyle() |
| 503 | 503 | ->setMarkerOn($marker); |
| 504 | - }, array_filter($this->menu->getItems(), function (MenuItemInterface $item) { |
|
| 504 | + }, array_filter($this->menu->getItems(), function(MenuItemInterface $item) { |
|
| 505 | 505 | return $item instanceof SelectableInterface; |
| 506 | 506 | })); |
| 507 | 507 | |
@@ -513,10 +513,10 @@ discard block |
||
| 513 | 513 | |
| 514 | 514 | public function setItemExtra(string $extra) : self |
| 515 | 515 | { |
| 516 | - array_map(function (SelectableInterface $item) use ($extra) { |
|
| 516 | + array_map(function(SelectableInterface $item) use ($extra) { |
|
| 517 | 517 | $item->getStyle() |
| 518 | 518 | ->setItemExtra($extra); |
| 519 | - }, array_filter($this->menu->getItems(), function (MenuItemInterface $item) { |
|
| 519 | + }, array_filter($this->menu->getItems(), function(MenuItemInterface $item) { |
|
| 520 | 520 | return $item instanceof SelectableInterface; |
| 521 | 521 | })); |
| 522 | 522 | |
@@ -611,10 +611,10 @@ discard block |
||
| 611 | 611 | |
| 612 | 612 | public function displayExtra() : self |
| 613 | 613 | { |
| 614 | - array_map(function (SelectableInterface $item) { |
|
| 614 | + array_map(function(SelectableInterface $item) { |
|
| 615 | 615 | $item->getStyle() |
| 616 | 616 | ->setDisplaysExtra(true); |
| 617 | - }, array_filter($this->menu->getItems(), function (MenuItemInterface $item) { |
|
| 617 | + }, array_filter($this->menu->getItems(), function(MenuItemInterface $item) { |
|
| 618 | 618 | return $item instanceof SelectableInterface; |
| 619 | 619 | })); |
| 620 | 620 | |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | |
| 627 | 627 | private function itemsHaveExtra(array $items) : bool |
| 628 | 628 | { |
| 629 | - return !empty(array_filter($items, function (MenuItemInterface $item) { |
|
| 629 | + return !empty(array_filter($items, function(MenuItemInterface $item) { |
|
| 630 | 630 | return $item->showsItemExtra(); |
| 631 | 631 | })); |
| 632 | 632 | } |
@@ -640,10 +640,10 @@ discard block |
||
| 640 | 640 | if (!$this->menu->getSelectableStyle()->getDisplaysExtra()) { |
| 641 | 641 | $displaysExtra = $this->itemsHaveExtra($this->menu->getItems()); |
| 642 | 642 | |
| 643 | - array_map(function (SelectableInterface $item) use ($displaysExtra) { |
|
| 643 | + array_map(function(SelectableInterface $item) use ($displaysExtra) { |
|
| 644 | 644 | $item->getStyle() |
| 645 | 645 | ->setDisplaysExtra($displaysExtra); |
| 646 | - }, array_filter($this->menu->getItems(), function (MenuItemInterface $item) { |
|
| 646 | + }, array_filter($this->menu->getItems(), function(MenuItemInterface $item) { |
|
| 647 | 647 | return $item instanceof SelectableInterface; |
| 648 | 648 | })); |
| 649 | 649 | } |