1 | <?php |
||
16 | abstract class MenuItem |
||
17 | { |
||
18 | /** @var string $label Text label for this subsection. */ |
||
19 | protected $label = ''; |
||
20 | |||
21 | /** @var string $counter Index of counter specified in the menu options. */ |
||
22 | protected $counter = ''; |
||
23 | |||
24 | /** @var string $url URL to use for this menu item. */ |
||
25 | protected $url = ''; |
||
26 | |||
27 | /** @var string[] $permission Array of permissions to check for this subsection. */ |
||
28 | protected $permission = []; |
||
29 | |||
30 | /** @var bool $enabled Bool to say whether this should be enabled. */ |
||
31 | protected $enabled = true; |
||
32 | |||
33 | /** |
||
34 | * @param array $arr |
||
35 | * |
||
36 | * @return MenuItem |
||
37 | */ |
||
38 | public static function buildFromArray(array $arr): MenuItem |
||
54 | |||
55 | /** |
||
56 | * @return string |
||
57 | */ |
||
58 | public function getLabel(): string |
||
62 | |||
63 | /** |
||
64 | * @param string $label |
||
65 | * |
||
66 | * @return MenuItem |
||
67 | */ |
||
68 | public function setLabel(string $label): MenuItem |
||
74 | |||
75 | /** |
||
76 | * @return string |
||
77 | */ |
||
78 | public function getCounter(): string |
||
82 | |||
83 | /** |
||
84 | * @param string $counter |
||
85 | * |
||
86 | * @return MenuItem |
||
87 | */ |
||
88 | public function setCounter(string $counter): MenuItem |
||
94 | |||
95 | /** |
||
96 | * @return string |
||
97 | */ |
||
98 | public function getUrl(): string |
||
102 | |||
103 | /** |
||
104 | * @param string $url |
||
105 | * |
||
106 | * @return MenuItem |
||
107 | */ |
||
108 | public function setUrl(string $url): MenuItem |
||
114 | |||
115 | /** |
||
116 | * @return string[] |
||
117 | */ |
||
118 | public function getPermission(): array |
||
122 | |||
123 | /** |
||
124 | * @param string[] $permission |
||
125 | * |
||
126 | * @return MenuItem |
||
127 | */ |
||
128 | public function setPermission(array $permission): MenuItem |
||
134 | |||
135 | /** |
||
136 | * @return boolean |
||
137 | */ |
||
138 | public function isEnabled(): bool |
||
142 | |||
143 | /** |
||
144 | * @param boolean $enabled |
||
145 | * |
||
146 | * @return MenuItem |
||
147 | */ |
||
148 | public function setEnabled(bool $enabled): MenuItem |
||
154 | } |
||
155 |