1 | <?php |
||
14 | class App |
||
15 | { |
||
16 | /** |
||
17 | * Return value from application |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | public $output = ''; |
||
22 | |||
23 | /** |
||
24 | * @var Dependency $dependency |
||
25 | */ |
||
26 | private $dependency; |
||
27 | |||
28 | /** |
||
29 | * @var Emitter |
||
30 | */ |
||
31 | private $event; |
||
32 | |||
33 | /** |
||
34 | * @var Router |
||
35 | */ |
||
36 | private $router; |
||
37 | |||
38 | /** |
||
39 | * @var Request |
||
40 | */ |
||
41 | private $request; |
||
42 | |||
43 | /** |
||
44 | * Application bootstrap process |
||
45 | * |
||
46 | * The application registers the configuration in the app/config/core.php |
||
47 | * and then processes, and makes available the configured resources |
||
48 | * |
||
49 | * App constructor. |
||
50 | * @param Dependency $dependency |
||
51 | */ |
||
52 | 5 | public function __construct(Dependency $dependency) |
|
65 | |||
66 | /** |
||
67 | * Calls the proper shell for app execution |
||
68 | * |
||
69 | * @access private |
||
70 | */ |
||
71 | 5 | public function initialize() |
|
81 | |||
82 | /** |
||
83 | * @param $request array |
||
84 | * @param $request[0] string namespace to load |
||
85 | * @param $request[1] string method to call |
||
86 | * @access private |
||
87 | * @return bool |
||
88 | * @throws Exception |
||
89 | */ |
||
90 | 5 | private function processRequestParameters($request) : bool |
|
110 | |||
111 | /** |
||
112 | * @param bool $isRouteCallback |
||
113 | */ |
||
114 | 4 | private function start(bool $isRouteCallback) |
|
129 | |||
130 | /** |
||
131 | * Prepare application return value into a string |
||
132 | * |
||
133 | * @access public |
||
134 | * @return string |
||
135 | */ |
||
136 | 1 | public function __toString() |
|
140 | } |
||
141 |
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: