1 | <?php |
||
10 | class Core extends Container implements CoreContract |
||
11 | { |
||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | const VERSION = '0.1.0'; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $basePath; |
||
21 | |||
22 | /** |
||
23 | * @var bool |
||
24 | */ |
||
25 | protected $hasBeenBootstrapped = false; |
||
26 | |||
27 | /** |
||
28 | * @var bool |
||
29 | */ |
||
30 | protected $booted = false; |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $serviceProviders = []; |
||
36 | |||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | protected $loadedProviders = []; |
||
41 | |||
42 | /** |
||
43 | * @var array |
||
44 | */ |
||
45 | protected $plugins = []; |
||
46 | |||
47 | /** |
||
48 | * @param string|null $basePath |
||
49 | * @return void |
||
|
|||
50 | */ |
||
51 | public function __construct($basePath = null) |
||
61 | |||
62 | /** |
||
63 | * @return string |
||
64 | */ |
||
65 | public function version() |
||
69 | |||
70 | /** |
||
71 | * @return string |
||
72 | */ |
||
73 | public function basePath() |
||
77 | |||
78 | /** |
||
79 | * @param \Spires\Core\ServiceProvider|string $provider |
||
80 | * @param array $config |
||
81 | * @param bool $force |
||
82 | * @return ServiceProvider |
||
83 | */ |
||
84 | public function register($provider, array $config = [], $force = false) |
||
114 | |||
115 | /** |
||
116 | * Get the service providers that have been loaded. |
||
117 | * |
||
118 | * @return array |
||
119 | */ |
||
120 | public function getLoadedProviders() |
||
124 | |||
125 | /** |
||
126 | * Get all plugins. |
||
127 | * |
||
128 | * @return array |
||
129 | */ |
||
130 | public function getPlugins() |
||
134 | |||
135 | /** |
||
136 | * Boot the application's service providers. |
||
137 | * |
||
138 | * @return void |
||
139 | */ |
||
140 | public function boot() |
||
152 | |||
153 | /** |
||
154 | * Determine if the application has booted. |
||
155 | * |
||
156 | * @return bool |
||
157 | */ |
||
158 | public function isBooted() |
||
162 | |||
163 | /** |
||
164 | * Register the basic bindings into the container. |
||
165 | * |
||
166 | * @return void |
||
167 | */ |
||
168 | protected function registerBaseBindings() |
||
175 | |||
176 | /** |
||
177 | * Register all of the base service providers. |
||
178 | * |
||
179 | * @return void |
||
180 | */ |
||
181 | protected function registerBaseServiceProviders() |
||
186 | |||
187 | /** |
||
188 | * Set the base path for the application. |
||
189 | * |
||
190 | * @param string $basePath |
||
191 | * @return $this |
||
192 | */ |
||
193 | protected function setBasePath($basePath) |
||
201 | |||
202 | /** |
||
203 | * Bind all of the application paths in the container. |
||
204 | * |
||
205 | * @return void |
||
206 | */ |
||
207 | protected function bindPathsInContainer() |
||
211 | |||
212 | /** |
||
213 | * Get the registered service provider instance if it exists. |
||
214 | * |
||
215 | * @param \Spires\Core\ServiceProvider|string $provider |
||
216 | * @return \Spires\Core\ServiceProvider|null |
||
217 | */ |
||
218 | protected function getProvider($provider) |
||
230 | |||
231 | /** |
||
232 | * Resolve a service provider instance from the class name. |
||
233 | * |
||
234 | * @param string $provider |
||
235 | * @return \Spires\Core\ServiceProvider |
||
236 | */ |
||
237 | protected function resolveProviderClass($provider) |
||
241 | |||
242 | /** |
||
243 | * Mark the given provider as registered. |
||
244 | * |
||
245 | * @param \Spires\Core\ServiceProvider $provider |
||
246 | * @return void |
||
247 | */ |
||
248 | protected function markAsRegistered($provider) |
||
253 | |||
254 | /** |
||
255 | * Add plugins from the service provider. |
||
256 | * |
||
257 | * @param \Spires\Core\ServiceProvider $provider |
||
258 | * @return void |
||
259 | */ |
||
260 | protected function addPlugins($provider) |
||
266 | |||
267 | /** |
||
268 | * Register the given service provider. |
||
269 | * |
||
270 | * @param \Spires\Core\ServiceProvider $provider |
||
271 | * @param array $config |
||
272 | * @return mixed |
||
273 | * |
||
274 | * @throws \Spires\Contracts\Core\UndefinedConfigKeyException |
||
275 | */ |
||
276 | protected function registerConfig(ServiceProvider $provider, array $config) |
||
290 | |||
291 | /** |
||
292 | * Register the given service provider. |
||
293 | * |
||
294 | * @param \Spires\Core\ServiceProvider $provider |
||
295 | * @return mixed |
||
296 | */ |
||
297 | protected function registerProvider(ServiceProvider $provider) |
||
303 | |||
304 | /** |
||
305 | * Boot the given service provider. |
||
306 | * |
||
307 | * @param \Spires\Core\ServiceProvider $provider |
||
308 | * @return mixed |
||
309 | */ |
||
310 | protected function bootProvider(ServiceProvider $provider) |
||
316 | } |
||
317 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.