1 | <?php |
||
12 | trait UrlHelperTrait |
||
13 | { |
||
14 | /** |
||
15 | * Reference to the page name for linking to posts |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $postPage; |
||
20 | |||
21 | /** |
||
22 | * Reference to the page name for linking to categories |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $categoryPage; |
||
27 | |||
28 | /** |
||
29 | * @param $items |
||
30 | * @param $urlPage |
||
31 | * @param $controller |
||
32 | */ |
||
33 | public function setUrls($items, $urlPage, $controller) |
||
41 | |||
42 | /** |
||
43 | * Set Urls to posts |
||
44 | * |
||
45 | * @param Post $post |
||
46 | */ |
||
47 | public function setPostUrls(Post $post) |
||
57 | } |
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: