1 | <?php |
||
10 | trait HasNavigation |
||
11 | { |
||
12 | /** |
||
13 | * The page id name |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $pageId; |
||
18 | |||
19 | /** |
||
20 | * The page icon class name |
||
21 | * |
||
22 | * @var string |
||
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 | * @return mixed |
||
42 | */ |
||
43 | public function getPageId() |
||
44 | { |
||
45 | return $this->pageId; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @param mixed $pageId |
||
50 | * |
||
51 | * @return $this |
||
52 | */ |
||
53 | public function setPageId($pageId) |
||
54 | { |
||
55 | $this->pageId = $pageId; |
||
56 | |||
57 | return $this; |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @return mixed |
||
62 | */ |
||
63 | public function getIcon() |
||
64 | { |
||
65 | return $this->icon; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @param mixed $icon |
||
70 | * |
||
71 | * @return $this |
||
72 | */ |
||
73 | public function setIcon($icon) |
||
74 | { |
||
75 | $this->icon = $icon; |
||
76 | |||
77 | return $this; |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @return mixed |
||
82 | */ |
||
83 | public function getParentPageId() |
||
87 | |||
88 | /** |
||
89 | * @param mixed $parentPageId |
||
90 | * |
||
91 | * @return $this |
||
92 | */ |
||
93 | public function setParentPageId($parentPageId) |
||
99 | |||
100 | public function hasParentPageId() |
||
104 | |||
105 | /** |
||
106 | * @return int |
||
107 | */ |
||
108 | public function getPriority(): int |
||
112 | |||
113 | /** |
||
114 | * @param int $priority |
||
115 | * |
||
116 | * @return $this |
||
117 | */ |
||
118 | public function setPriority(int $priority) |
||
124 | |||
125 | /** |
||
126 | * {@inheritdoc} |
||
127 | */ |
||
128 | public function getNavigation() |
||
132 | |||
133 | /** |
||
134 | * {@inheritdoc} |
||
135 | */ |
||
136 | public function addToNavigation($badge = null) |
||
157 | |||
158 | /** |
||
159 | * page |
||
160 | * |
||
161 | * @param null $badge |
||
162 | * |
||
163 | * @return \Sco\Admin\Navigation\Page |
||
164 | */ |
||
165 | protected function makePage($badge = null) |
||
186 | |||
187 | /** |
||
188 | * @param array $parameters |
||
189 | * |
||
190 | * @return string |
||
191 | */ |
||
192 | public function getViewUrl(array $parameters = []) |
||
198 | } |
||
199 |
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: