Conditions | 2 |
Paths | 1 |
Total Lines | 27 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
45 | public function getSelectAction() : ?callable |
||
46 | { |
||
47 | return function (CliMenu $cliMenu) { |
||
48 | $parentItem = $cliMenu->getItemByIndex($cliMenu->getSelectedItemIndex()); |
||
49 | |||
50 | $siblings = $parentItem instanceof SplitItem |
||
51 | ? $parentItem->getItems() |
||
52 | : $cliMenu->getItems(); |
||
53 | |||
54 | $filtered = array_filter( |
||
55 | $siblings, |
||
56 | function (MenuItemInterface $item) { |
||
57 | return $item instanceof self; |
||
58 | } |
||
59 | ); |
||
60 | |||
61 | array_walk( |
||
62 | $filtered, |
||
63 | function (RadioItem $checkableItem) { |
||
64 | $checkableItem->setUnchecked(); |
||
65 | } |
||
66 | ); |
||
67 | |||
68 | $this->setChecked(); |
||
69 | $cliMenu->redraw(); |
||
70 | |||
71 | return ($this->selectAction)($cliMenu); |
||
72 | }; |
||
75 |