@@ -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 | $itemStyle = $item->getStyle(); |
@@ -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 | : ''; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | protected function createMenuClosure($builder, CliMenu $parent = null) : Closure |
| 237 | 237 | { |
| 238 | - return function () use ($builder, $parent) { |
|
| 238 | + return function() use ($builder, $parent) { |
|
| 239 | 239 | $menu = $builder->build(); |
| 240 | 240 | |
| 241 | 241 | if ($parent) { |
@@ -250,21 +250,21 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | // If user changed this style, persist to the menu so children CheckableItems may use it |
| 252 | 252 | if ($this->menu->getCheckableStyle()->getIsCustom()) { |
| 253 | - $menu->setCheckableStyle(function (CheckableStyle $style) { |
|
| 253 | + $menu->setCheckableStyle(function(CheckableStyle $style) { |
|
| 254 | 254 | $style->fromArray($this->menu->getCheckableStyle()->toArray()); |
| 255 | 255 | }); |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | // If user changed this style, persist to the menu so children RadioItems may use it |
| 259 | 259 | if ($this->menu->getRadioStyle()->getIsCustom()) { |
| 260 | - $menu->setRadioStyle(function (RadioStyle $style) { |
|
| 260 | + $menu->setRadioStyle(function(RadioStyle $style) { |
|
| 261 | 261 | $style->fromArray($this->menu->getRadioStyle()->toArray()); |
| 262 | 262 | }); |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // If user changed this style, persist to the menu so children SelectableItems may use it |
| 266 | 266 | if ($this->menu->getSelectableStyle()->getIsCustom()) { |
| 267 | - $menu->setSelectableStyle(function (SelectableStyle $style) { |
|
| 267 | + $menu->setSelectableStyle(function(SelectableStyle $style) { |
|
| 268 | 268 | $style->fromArray($this->menu->getSelectableStyle()->toArray()); |
| 269 | 269 | }); |
| 270 | 270 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | private function processItemShortcut(MenuItemInterface $item) : void |
| 310 | 310 | { |
| 311 | - $this->processIndividualShortcut($item, function (CliMenu $menu) use ($item) { |
|
| 311 | + $this->processIndividualShortcut($item, function(CliMenu $menu) use ($item) { |
|
| 312 | 312 | $menu->executeAsSelected($item); |
| 313 | 313 | }); |
| 314 | 314 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | private function processSplitItemShortcuts(SplitItem $splitItem) : void |
| 317 | 317 | { |
| 318 | 318 | foreach ($splitItem->getItems() as $item) { |
| 319 | - $this->processIndividualShortcut($item, function (CliMenu $menu) use ($splitItem, $item) { |
|
| 319 | + $this->processIndividualShortcut($item, function(CliMenu $menu) use ($splitItem, $item) { |
|
| 320 | 320 | $current = $splitItem->getSelectedItemIndex(); |
| 321 | 321 | |
| 322 | 322 | $splitItem->setSelectedItemIndex( |
@@ -356,21 +356,21 @@ discard block |
||
| 356 | 356 | |
| 357 | 357 | // If user changed this style, persist to the menu so children CheckableItems may use it |
| 358 | 358 | if ($this->menu->getCheckableStyle()->getIsCustom()) { |
| 359 | - $builder->setCheckableStyle(function (CheckableStyle $style) { |
|
| 359 | + $builder->setCheckableStyle(function(CheckableStyle $style) { |
|
| 360 | 360 | $style->fromArray($this->menu->getCheckableStyle()->toArray()); |
| 361 | 361 | }); |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | // If user changed this style, persist to the menu so children RadioItems may use it |
| 365 | 365 | if ($this->menu->getRadioStyle()->getIsCustom()) { |
| 366 | - $builder->setRadioStyle(function (RadioStyle $style) { |
|
| 366 | + $builder->setRadioStyle(function(RadioStyle $style) { |
|
| 367 | 367 | $style->fromArray($this->menu->getRadioStyle()->toArray()); |
| 368 | 368 | }); |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | // If user changed this style, persist to the menu so children SelectableItems may use it |
| 372 | 372 | if ($this->menu->getSelectableStyle()->getIsCustom()) { |
| 373 | - $builder->setSelectableStyle(function (SelectableStyle $style) { |
|
| 373 | + $builder->setSelectableStyle(function(SelectableStyle $style) { |
|
| 374 | 374 | $style->fromArray($this->menu->getSelectableStyle()->toArray()); |
| 375 | 375 | }); |
| 376 | 376 | } |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | private function itemsHaveExtra(array $items) : bool |
| 592 | 592 | { |
| 593 | - return !empty(array_filter($items, function (MenuItemInterface $item) { |
|
| 593 | + return !empty(array_filter($items, function(MenuItemInterface $item) { |
|
| 594 | 594 | return $item->showsItemExtra(); |
| 595 | 595 | })); |
| 596 | 596 | } |
@@ -202,25 +202,25 @@ |
||
| 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 | - $menu->setCheckableStyle(function (CheckableStyle $style) { |
|
| 210 | + $menu->setCheckableStyle(function(CheckableStyle $style) { |
|
| 211 | 211 | $style->fromArray($this->menu->getCheckableStyle()->toArray()); |
| 212 | 212 | }); |
| 213 | 213 | |
| 214 | 214 | // If user changed this style, persist to the menu so children RadioItems may use it |
| 215 | 215 | if ($this->menu->getRadioStyle()->getIsCustom()) { |
| 216 | - $menu->setRadioStyle(function (RadioStyle $style) { |
|
| 216 | + $menu->setRadioStyle(function(RadioStyle $style) { |
|
| 217 | 217 | $style->fromArray($this->menu->getRadioStyle()->toArray()); |
| 218 | 218 | }); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | // If user changed this style, persist to the menu so children SelectableItems may use it |
| 222 | 222 | if ($this->menu->getSelectableStyle()->getIsCustom()) { |
| 223 | - $menu->setSelectableStyle(function (SelectableStyle $style) { |
|
| 223 | + $menu->setSelectableStyle(function(SelectableStyle $style) { |
|
| 224 | 224 | $style->fromArray($this->menu->getSelectableStyle()->toArray()); |
| 225 | 225 | }); |
| 226 | 226 | } |