1 | <?php |
||
14 | trait BuilderUtils |
||
15 | { |
||
16 | /** |
||
17 | * @var null|Builder |
||
18 | */ |
||
19 | private $parent; |
||
20 | |||
21 | /** |
||
22 | * @var self[] |
||
23 | */ |
||
24 | private $subMenuBuilders = []; |
||
25 | |||
26 | /** |
||
27 | * @var CliMenu[] |
||
28 | */ |
||
29 | private $subMenus = []; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | private $menuItems = []; |
||
35 | |||
36 | public function addItem( |
||
46 | |||
47 | public function addStaticItem(string $text) : self |
||
53 | |||
54 | public function addLineBreak(string $breakChar = ' ', int $lines = 1) : self |
||
60 | |||
61 | /** |
||
62 | * Add a submenu with a name. The name will be displayed as the item text |
||
63 | * in the parent menu. |
||
64 | */ |
||
65 | public function addSubMenu(string $name, CliMenuBuilder $subMenuBuilder = null) : Builder |
||
77 | |||
78 | private function buildSubMenus(array $items) : array |
||
95 | |||
96 | /** |
||
97 | * Return to parent builder |
||
98 | * |
||
99 | * @throws RuntimeException |
||
100 | */ |
||
101 | public function end() : ?Builder |
||
109 | } |
||
110 |