| 1 | <?php |
||
| 16 | class Menu |
||
| 17 | { |
||
| 18 | |||
| 19 | use MethodPropertyAccess, ObjectOptions; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Store the menu items. |
||
| 23 | * |
||
| 24 | * @var \Illuminate\Support\Collection |
||
| 25 | */ |
||
| 26 | protected $items; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Store the menu label. |
||
| 30 | * |
||
| 31 | * @var null|string |
||
| 32 | */ |
||
| 33 | protected $label; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @var \Iatstuti\SimpleMenu\Presenters\MenuPresenter |
||
| 37 | */ |
||
| 38 | protected $presenter; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @var array |
||
| 42 | */ |
||
| 43 | private $options; |
||
| 44 | |||
| 45 | |||
| 46 | /** |
||
| 47 | * Menu constructor. |
||
| 48 | * |
||
| 49 | * @param string|null $label |
||
| 50 | * @param array $options |
||
| 51 | */ |
||
| 52 | public function __construct($label = null, array $options = [ ]) |
||
| 58 | |||
| 59 | |||
| 60 | /** |
||
| 61 | * Return this menu's label. |
||
| 62 | * |
||
| 63 | * @return null|string |
||
| 64 | */ |
||
| 65 | public function label() |
||
| 69 | |||
| 70 | |||
| 71 | /** |
||
| 72 | * Add a new link to the menu. |
||
| 73 | * |
||
| 74 | * @param string $item |
||
| 75 | * @param string $link |
||
| 76 | * @param array $options |
||
| 77 | * |
||
| 78 | * @return $this |
||
|
|
|||
| 79 | */ |
||
| 80 | public function link($item, $link, array $options = [ ]) |
||
| 90 | |||
| 91 | |||
| 92 | /** |
||
| 93 | * Return this menu's items. |
||
| 94 | * |
||
| 95 | * @return \Illuminate\Support\Collection |
||
| 96 | */ |
||
| 97 | public function items() |
||
| 101 | |||
| 102 | |||
| 103 | /** |
||
| 104 | * @return $this |
||
| 105 | */ |
||
| 106 | private function sortItems() |
||
| 114 | |||
| 115 | |||
| 116 | /** |
||
| 117 | * Add a new sub menu item to the menu. |
||
| 118 | * |
||
| 119 | * @param \Iatstuti\SimpleMenu\Menu $menu |
||
| 120 | * |
||
| 121 | * @return $this |
||
| 122 | */ |
||
| 123 | public function subMenu(Menu $menu) |
||
| 131 | |||
| 132 | |||
| 133 | /** |
||
| 134 | * Return this menu's weight. |
||
| 135 | * |
||
| 136 | * @return int |
||
|
1 ignored issue
–
show
|
|||
| 137 | */ |
||
| 138 | public function weight() |
||
| 142 | } |
||
| 143 |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.