1 | <?php |
||
16 | class Section |
||
17 | { |
||
18 | /** |
||
19 | * @var GuardInterface |
||
20 | */ |
||
21 | private $guard = null; |
||
22 | |||
23 | /** |
||
24 | * @var array |
||
25 | */ |
||
26 | private $section = [ |
||
27 | 'title' => '', |
||
28 | 'badge' => '', |
||
29 | 'icon' => '', |
||
30 | 'items' => [] |
||
31 | ]; |
||
32 | |||
33 | /** |
||
34 | * @var Item[] |
||
35 | */ |
||
36 | private $items = []; |
||
37 | |||
38 | /** |
||
39 | * @param GuardInterface $guard |
||
40 | * @param array $section |
||
41 | */ |
||
42 | public function __construct(GuardInterface $guard, array $section) |
||
51 | |||
52 | /** |
||
53 | * Section title. |
||
54 | * |
||
55 | * @return string |
||
56 | */ |
||
57 | public function getTitle() |
||
61 | |||
62 | /** |
||
63 | * @return string |
||
64 | */ |
||
65 | public function getIcon() |
||
69 | |||
70 | /** |
||
71 | * Must return true is section has at least one available item. |
||
72 | * |
||
73 | * @return bool |
||
74 | */ |
||
75 | public function isAvailable() |
||
85 | |||
86 | /** |
||
87 | * Must return true if at least one of section items points to a given controller (based on |
||
88 | * target). |
||
89 | * |
||
90 | * @param string $controller |
||
91 | * |
||
92 | * @return bool |
||
93 | */ |
||
94 | public function hasController($controller) |
||
107 | |||
108 | /** |
||
109 | * @return Item[] |
||
110 | */ |
||
111 | public function getItems() |
||
115 | } |