1 | <?php |
||
13 | class ViewComponent { |
||
14 | |||
15 | /** |
||
16 | * @var string View location. E.g. "/path/to/views/default/" |
||
17 | */ |
||
18 | public $location; |
||
19 | |||
20 | /** |
||
21 | * @var string View name. E.g. "css/elgg" |
||
22 | */ |
||
23 | public $view; |
||
24 | |||
25 | /** |
||
26 | * @var string View file extension, if known. E.g. "php" |
||
27 | */ |
||
28 | public $extension = null; |
||
29 | |||
30 | /** |
||
31 | * @var bool Is this component represent an overridden view? |
||
32 | */ |
||
33 | public $overridden = false; |
||
34 | |||
35 | /** |
||
36 | * @return string Return the component as a file path |
||
37 | */ |
||
38 | public function getFile() { |
||
58 | |||
59 | /** |
||
60 | * Get a component from the path and location |
||
61 | * |
||
62 | * @param string $path Full file path |
||
63 | * @param string $location Base location of view |
||
64 | * |
||
65 | * @return ViewComponent |
||
66 | */ |
||
67 | public static function fromPaths($path, $location) { |
||
89 | } |
||
90 |
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: