1 | <?php |
||
30 | abstract class BaseApplication |
||
31 | { |
||
32 | private static $instance; |
||
33 | |||
34 | /** |
||
35 | * @var ContainerInterface |
||
36 | */ |
||
37 | protected $container; |
||
38 | |||
39 | /** |
||
40 | * @var Binder |
||
41 | */ |
||
42 | protected $binder; |
||
43 | |||
44 | /** |
||
45 | * @var SymfonyConsoleApplication |
||
46 | */ |
||
47 | private $symfonyApplication; |
||
48 | |||
49 | /** |
||
50 | * @var Command[] |
||
51 | */ |
||
52 | private $commands; |
||
53 | |||
54 | /** |
||
55 | * @return static |
||
56 | */ |
||
57 | public static function getInstance() |
||
65 | |||
66 | protected final function __construct() |
||
79 | |||
80 | /** |
||
81 | * Runs the application |
||
82 | * @throws \Exception |
||
83 | */ |
||
84 | public final function run() |
||
90 | |||
91 | /** |
||
92 | * @param $name |
||
93 | * @param $definition |
||
94 | * @param $callable |
||
95 | */ |
||
96 | public function addCommand($name, $definition, $callable) |
||
109 | |||
110 | private function registerServices() |
||
119 | |||
120 | private function registerCommands() |
||
129 | |||
130 | /** |
||
131 | * @param string|ServiceProvider $provider |
||
132 | * @return ServiceProvider |
||
133 | * @throws InvalidServiceProviderException |
||
134 | */ |
||
135 | private function resolveServiceProvider($provider) |
||
147 | |||
148 | /** |
||
149 | * @param $command |
||
150 | * @return Command |
||
151 | * @throws InvalidCommandException |
||
152 | */ |
||
153 | private function resolveCommand($command) |
||
165 | |||
166 | /** |
||
167 | * @return string[] |
||
168 | */ |
||
169 | protected function getAllCommands() |
||
173 | |||
174 | /** |
||
175 | * @return string[] |
||
176 | */ |
||
177 | abstract protected function getCommands(); |
||
178 | |||
179 | /** |
||
180 | * @return string[] |
||
181 | */ |
||
182 | abstract protected function getProviders(); |
||
183 | |||
184 | /** |
||
185 | * @return string |
||
186 | */ |
||
187 | abstract protected function getVersion(); |
||
188 | |||
189 | /** |
||
190 | * @return string |
||
191 | */ |
||
192 | abstract protected function getName(); |
||
193 | } |
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: