@@ -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 | ); |
@@ -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 | : ''; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | */ |
235 | 235 | protected function createMenuClosure($builder) : Closure |
236 | 236 | { |
237 | - return function () use ($builder) { |
|
237 | + return function() use ($builder) { |
|
238 | 238 | $menu = $builder->build(); |
239 | 239 | |
240 | 240 | $menu->setParent($this->menu); |
@@ -247,21 +247,21 @@ discard block |
||
247 | 247 | |
248 | 248 | // If user changed this style, persist to the menu so children CheckableItems may use it |
249 | 249 | if ($this->menu->getCheckableStyle()->getIsCustom()) { |
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 | 254 | |
255 | 255 | // If user changed this style, persist to the menu so children RadioItems may use it |
256 | 256 | if ($this->menu->getRadioStyle()->getIsCustom()) { |
257 | - $menu->setRadioStyle(function (RadioStyle $style) { |
|
257 | + $menu->setRadioStyle(function(RadioStyle $style) { |
|
258 | 258 | $style->fromArray($this->menu->getRadioStyle()->toArray()); |
259 | 259 | }); |
260 | 260 | } |
261 | 261 | |
262 | 262 | // If user changed this style, persist to the menu so children SelectableItems may use it |
263 | 263 | if ($this->menu->getSelectableStyle()->getIsCustom()) { |
264 | - $menu->setSelectableStyle(function (SelectableStyle $style) { |
|
264 | + $menu->setSelectableStyle(function(SelectableStyle $style) { |
|
265 | 265 | $style->fromArray($this->menu->getSelectableStyle()->toArray()); |
266 | 266 | }); |
267 | 267 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | |
306 | 306 | private function processItemShortcut(MenuItemInterface $item) : void |
307 | 307 | { |
308 | - $this->processIndividualShortcut($item, function (CliMenu $menu) use ($item) { |
|
308 | + $this->processIndividualShortcut($item, function(CliMenu $menu) use ($item) { |
|
309 | 309 | $menu->executeAsSelected($item); |
310 | 310 | }); |
311 | 311 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | private function processSplitItemShortcuts(SplitItem $splitItem) : void |
314 | 314 | { |
315 | 315 | foreach ($splitItem->getItems() as $item) { |
316 | - $this->processIndividualShortcut($item, function (CliMenu $menu) use ($splitItem, $item) { |
|
316 | + $this->processIndividualShortcut($item, function(CliMenu $menu) use ($splitItem, $item) { |
|
317 | 317 | $current = $splitItem->getSelectedItemIndex(); |
318 | 318 | |
319 | 319 | $splitItem->setSelectedItemIndex( |
@@ -353,21 +353,21 @@ discard block |
||
353 | 353 | |
354 | 354 | // If user changed this style, persist to the menu so children CheckableItems may use it |
355 | 355 | if ($this->menu->getCheckableStyle()->getIsCustom()) { |
356 | - $builder->setCheckableStyle(function (CheckableStyle $style) { |
|
356 | + $builder->setCheckableStyle(function(CheckableStyle $style) { |
|
357 | 357 | $style->fromArray($this->menu->getCheckableStyle()->toArray()); |
358 | 358 | }); |
359 | 359 | } |
360 | 360 | |
361 | 361 | // If user changed this style, persist to the menu so children RadioItems may use it |
362 | 362 | if ($this->menu->getRadioStyle()->getIsCustom()) { |
363 | - $builder->setRadioStyle(function (RadioStyle $style) { |
|
363 | + $builder->setRadioStyle(function(RadioStyle $style) { |
|
364 | 364 | $style->fromArray($this->menu->getRadioStyle()->toArray()); |
365 | 365 | }); |
366 | 366 | } |
367 | 367 | |
368 | 368 | // If user changed this style, persist to the menu so children SelectableItems may use it |
369 | 369 | if ($this->menu->getSelectableStyle()->getIsCustom()) { |
370 | - $builder->setSelectableStyle(function (SelectableStyle $style) { |
|
370 | + $builder->setSelectableStyle(function(SelectableStyle $style) { |
|
371 | 371 | $style->fromArray($this->menu->getSelectableStyle()->toArray()); |
372 | 372 | }); |
373 | 373 | } |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | |
588 | 588 | private function itemsHaveExtra(array $items) : bool |
589 | 589 | { |
590 | - return !empty(array_filter($items, function (MenuItemInterface $item) { |
|
590 | + return !empty(array_filter($items, function(MenuItemInterface $item) { |
|
591 | 591 | return $item->showsItemExtra(); |
592 | 592 | })); |
593 | 593 | } |
@@ -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 | } |