1111 */
1212class SelectableItem implements MenuItemInterface
1313{
14+ /**
15+ * @var string
16+ */
17+ private $ text ;
18+
1419 /**
1520 * @var callable
1621 */
1722 private $ selectAction ;
1823
19- private $ text = '' ;
20-
21- private $ showItemExtra = false ;
24+ /**
25+ * @var bool
26+ */
27+ private $ showItemExtra ;
2228
23- private $ disabled = false ;
29+ /**
30+ * @var bool
31+ */
32+ private $ disabled ;
2433
2534 /**
26- * @var SelectableStyle;
35+ * @var SelectableStyle
2736 */
2837 private $ style ;
2938
@@ -33,10 +42,10 @@ public function __construct(
3342 bool $ showItemExtra = false ,
3443 bool $ disabled = false
3544 ) {
36- $ this ->text = $ text ;
37- $ this ->selectAction = $ selectAction ;
45+ $ this ->text = $ text ;
46+ $ this ->selectAction = $ selectAction ;
3847 $ this ->showItemExtra = $ showItemExtra ;
39- $ this ->disabled = $ disabled ;
48+ $ this ->disabled = $ disabled ;
4049
4150 $ this ->style = new SelectableStyle ();
4251 }
@@ -79,26 +88,6 @@ public function getRows(MenuStyle $style, bool $selected = false) : array
7988 }, $ rows , array_keys ($ rows ));
8089 }
8190
82- /**
83- * Execute the items callable if required
84- */
85- public function getSelectAction () : ?callable
86- {
87- return $ this ->selectAction ;
88- }
89-
90- public function getStyle () : SelectableStyle
91- {
92- return $ this ->style ;
93- }
94-
95- public function setStyle (SelectableStyle $ style ) : self
96- {
97- $ this ->style = $ style ;
98-
99- return $ this ;
100- }
101-
10291 /**
10392 * Return the raw string of text
10493 */
@@ -115,6 +104,14 @@ public function setText(string $text) : void
115104 $ this ->text = $ text ;
116105 }
117106
107+ /**
108+ * Execute the items callable if required
109+ */
110+ public function getSelectAction () : ?callable
111+ {
112+ return $ this ->selectAction ;
113+ }
114+
118115 /**
119116 * Can the item be selected
120117 */
@@ -123,6 +120,9 @@ public function canSelect() : bool
123120 return !$ this ->disabled ;
124121 }
125122
123+ /**
124+ * Whether or not we are showing item extra
125+ */
126126 public function showsItemExtra () : bool
127127 {
128128 return $ this ->showItemExtra ;
@@ -143,4 +143,16 @@ public function hideItemExtra() : void
143143 {
144144 $ this ->showItemExtra = false ;
145145 }
146+
147+ public function getStyle () : SelectableStyle
148+ {
149+ return $ this ->style ;
150+ }
151+
152+ public function setStyle (SelectableStyle $ style ) : self
153+ {
154+ $ this ->style = $ style ;
155+
156+ return $ this ;
157+ }
146158}
0 commit comments