@@ -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 | } |
@@ -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 ItemStyleInterface) { |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $extraPadLength = $style->getDisplaysExtra() ? 2 + mb_strlen($style->getItemExtra()) : 0; |
| 184 | 184 | |
| 185 | 185 | return array_map( |
| 186 | - function ($i) use ($cells, $length, $missingLength, $extraPadLength) { |
|
| 186 | + function($i) use ($cells, $length, $missingLength, $extraPadLength) { |
|
| 187 | 187 | return $this->buildRow($cells, $i, $length, $missingLength, $extraPadLength); |
| 188 | 188 | }, |
| 189 | 189 | range(0, max(array_map('count', $cells)) - 1) |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | implode( |
| 198 | 198 | '', |
| 199 | 199 | array_map( |
| 200 | - function ($cell) use ($index, $length, $extraPadLength) { |
|
| 200 | + function($cell) use ($index, $length, $extraPadLength) { |
|
| 201 | 201 | return $cell[$index] ?? str_repeat(' ', $length + $this->gutter + $extraPadLength); |
| 202 | 202 | }, |
| 203 | 203 | $cells |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | bool $isSelected, |
| 215 | 215 | string $itemExtra |
| 216 | 216 | ) : array { |
| 217 | - return array_map(function ($row, $index) use ($length, $style, $isSelected, $itemExtra) { |
|
| 217 | + return array_map(function($row, $index) use ($length, $style, $isSelected, $itemExtra) { |
|
| 218 | 218 | $invertedColoursSetCode = $isSelected |
| 219 | 219 | ? $style->getInvertedColoursSetCode() |
| 220 | 220 | : ''; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | protected function createMenuClosure($builder) : Closure |
| 237 | 237 | { |
| 238 | - return function () use ($builder) { |
|
| 238 | + return function() use ($builder) { |
|
| 239 | 239 | $menu = $builder->build(); |
| 240 | 240 | |
| 241 | 241 | $menu->setParent($this->menu); |
@@ -246,15 +246,15 @@ discard block |
||
| 246 | 246 | $menu->setStyle($this->menu->getStyle()); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - $menu->setCheckableStyle(function (CheckableStyle $style) { |
|
| 249 | + $menu->setCheckableStyle(function(CheckableStyle $style) { |
|
| 250 | 250 | $style->fromArray($this->menu->getCheckableStyle()->toArray()); |
| 251 | 251 | }); |
| 252 | 252 | |
| 253 | - $menu->setRadioStyle(function (RadioStyle $style) { |
|
| 253 | + $menu->setRadioStyle(function(RadioStyle $style) { |
|
| 254 | 254 | $style->fromArray($this->menu->getRadioStyle()->toArray()); |
| 255 | 255 | }); |
| 256 | 256 | |
| 257 | - $menu->setSelectableStyle(function (SelectableStyle $style) { |
|
| 257 | + $menu->setSelectableStyle(function(SelectableStyle $style) { |
|
| 258 | 258 | $style->fromArray($this->menu->getSelectableStyle()->toArray()); |
| 259 | 259 | }); |
| 260 | 260 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | private function processItemShortcut(MenuItemInterface $item) : void |
| 317 | 317 | { |
| 318 | - $this->processIndividualShortcut($item, function (CliMenu $menu) use ($item) { |
|
| 318 | + $this->processIndividualShortcut($item, function(CliMenu $menu) use ($item) { |
|
| 319 | 319 | $menu->executeAsSelected($item); |
| 320 | 320 | }); |
| 321 | 321 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | private function processSplitItemShortcuts(SplitItem $splitItem) : void |
| 324 | 324 | { |
| 325 | 325 | foreach ($splitItem->getItems() as $item) { |
| 326 | - $this->processIndividualShortcut($item, function (CliMenu $menu) use ($splitItem, $item) { |
|
| 326 | + $this->processIndividualShortcut($item, function(CliMenu $menu) use ($splitItem, $item) { |
|
| 327 | 327 | $current = $splitItem->getSelectedItemIndex(); |
| 328 | 328 | |
| 329 | 329 | $splitItem->setSelectedItemIndex( |
@@ -361,15 +361,15 @@ discard block |
||
| 361 | 361 | $builder->enableAutoShortcuts($this->autoShortcutsRegex); |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - $builder->setCheckableStyle(function (CheckableStyle $style) { |
|
| 364 | + $builder->setCheckableStyle(function(CheckableStyle $style) { |
|
| 365 | 365 | $style->fromArray($this->menu->getCheckableStyle()->toArray()); |
| 366 | 366 | }); |
| 367 | 367 | |
| 368 | - $builder->setRadioStyle(function (RadioStyle $style) { |
|
| 368 | + $builder->setRadioStyle(function(RadioStyle $style) { |
|
| 369 | 369 | $style->fromArray($this->menu->getRadioStyle()->toArray()); |
| 370 | 370 | }); |
| 371 | 371 | |
| 372 | - $builder->setSelectableStyle(function (SelectableStyle $style) { |
|
| 372 | + $builder->setSelectableStyle(function(SelectableStyle $style) { |
|
| 373 | 373 | $style->fromArray($this->menu->getSelectableStyle()->toArray()); |
| 374 | 374 | }); |
| 375 | 375 | |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | |
| 589 | 589 | private function itemsHaveExtra(array $items) : bool |
| 590 | 590 | { |
| 591 | - return !empty(array_filter($items, function (MenuItemInterface $item) { |
|
| 591 | + return !empty(array_filter($items, function(MenuItemInterface $item) { |
|
| 592 | 592 | return $item->showsItemExtra(); |
| 593 | 593 | })); |
| 594 | 594 | } |