1 | <?php |
||
14 | abstract class View implements ViewInterface, Arrayable |
||
15 | { |
||
16 | /** |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $with = []; |
||
20 | |||
21 | /** |
||
22 | * @var RepositoryInterface |
||
23 | */ |
||
24 | protected $repository; |
||
25 | |||
26 | protected $type; |
||
27 | |||
28 | protected $extensions; |
||
29 | |||
30 | public function __construct() |
||
38 | |||
39 | public function initialize() |
||
43 | |||
44 | public function extend($name, ExtensionInterface $extension) |
||
48 | |||
49 | public function setRepository(RepositoryInterface $repository) |
||
56 | |||
57 | public function getRepository() |
||
61 | |||
62 | /** |
||
63 | * @return string[] |
||
64 | */ |
||
65 | public function getWith() |
||
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | public function with($relations) |
||
79 | |||
80 | public function getQuery() |
||
92 | |||
93 | /** |
||
94 | * Add an "order by" clause to the query. |
||
95 | * |
||
96 | * @param string $column |
||
97 | * @param string $direction |
||
98 | * |
||
99 | * @return $this |
||
100 | */ |
||
101 | public function orderBy($column, $direction = 'asc') |
||
109 | |||
110 | public function toArray() |
||
116 | |||
117 | public function __call($name, $parameters) |
||
134 | } |
||
135 |
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: