1 | <?php |
||
10 | trait HasNavigation |
||
11 | { |
||
12 | /** |
||
13 | * The page id name. |
||
14 | * |
||
15 | * @var string|null |
||
16 | */ |
||
17 | protected $pageId; |
||
18 | |||
19 | /** |
||
20 | * The page icon class name. |
||
21 | * |
||
22 | * @var string|null |
||
23 | */ |
||
24 | protected $icon; |
||
25 | |||
26 | /** |
||
27 | * The page belong to page id name. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $parentPageId; |
||
32 | |||
33 | /** |
||
34 | * The page priority. |
||
35 | * |
||
36 | * @var int |
||
37 | */ |
||
38 | protected $priority = 100; |
||
39 | |||
40 | /** |
||
41 | * Get the page id |
||
42 | * |
||
43 | * @return string|null |
||
44 | */ |
||
45 | public function getPageId() |
||
49 | |||
50 | /** |
||
51 | * Set the page id |
||
52 | * |
||
53 | * @param string $pageId |
||
54 | * |
||
55 | * @return $this |
||
56 | */ |
||
57 | public function setPageId(string $pageId) |
||
63 | |||
64 | /** |
||
65 | * Get the page icon class name. |
||
66 | * |
||
67 | * @return string|null |
||
68 | */ |
||
69 | public function getIcon() |
||
73 | |||
74 | /** |
||
75 | * Set the page icon class name. |
||
76 | * |
||
77 | * @param string $icon |
||
78 | * |
||
79 | * @return $this |
||
80 | */ |
||
81 | public function setIcon(string $icon) |
||
87 | |||
88 | /** |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | public function getParentPageId(): string |
||
96 | |||
97 | /** |
||
98 | * @param string $parentPageId |
||
99 | * |
||
100 | * @return $this |
||
101 | */ |
||
102 | public function setParentPageId(string $parentPageId) |
||
108 | |||
109 | public function hasParentPageId() |
||
113 | |||
114 | /** |
||
115 | * @return int |
||
116 | */ |
||
117 | public function getPriority(): int |
||
121 | |||
122 | /** |
||
123 | * @param int $priority |
||
124 | * |
||
125 | * @return $this |
||
126 | */ |
||
127 | public function setPriority(int $priority) |
||
133 | |||
134 | /** |
||
135 | * {@inheritdoc} |
||
136 | */ |
||
137 | public function getNavigation() |
||
141 | |||
142 | /** |
||
143 | * {@inheritdoc} |
||
144 | */ |
||
145 | public function addToNavigation($badge = null) |
||
166 | |||
167 | /** |
||
168 | * Make page |
||
169 | * |
||
170 | * @param string|Closure|null $badge |
||
171 | * |
||
172 | * @return \Sco\Admin\Navigation\Page |
||
173 | */ |
||
174 | protected function makePage($badge = null) |
||
193 | |||
194 | /** |
||
195 | * Get the model display url. |
||
196 | * |
||
197 | * @param array $parameters |
||
198 | * |
||
199 | * @return string |
||
200 | */ |
||
201 | public function getDisplayUrl(array $parameters = []) |
||
207 | } |
||
208 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: