1 | <?php |
||
7 | trait View { |
||
8 | |||
9 | protected $definition = null, $error = false, $modifiable = false, $data = []; |
||
10 | |||
11 | # Get items |
||
12 | |||
13 | public function items(array $config = [], array $order_by = [], int $index = 0, int $display = 0) { |
||
17 | |||
18 | # Get items count |
||
19 | |||
20 | public function itemsCount(array $config = []) { |
||
24 | |||
25 | # Get children |
||
26 | |||
27 | public function children(array $config = [], array $order_by = [], int $index = 0, int $display = 0) { |
||
31 | |||
32 | # Get children count |
||
33 | |||
34 | public function childrenCount(array $config = []) { |
||
38 | |||
39 | # Get subtree |
||
40 | |||
41 | public function subtree(array $config = [], array $order_by = []) { |
||
45 | |||
46 | # Get subtree count |
||
47 | |||
48 | public function subtreeCount() { |
||
52 | |||
53 | # Get subtree depth |
||
54 | |||
55 | public function subtreeDepth() { |
||
59 | |||
60 | # Get path |
||
61 | |||
62 | public function path() { |
||
66 | } |
||
67 | } |
||
68 |
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: