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