1 | <?php |
||
10 | class Core extends Container implements CoreContract |
||
11 | { |
||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | const VERSION = '0.1.1'; |
||
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) |
||
59 | |||
60 | /** |
||
61 | * @return string |
||
62 | */ |
||
63 | public function version() |
||
67 | |||
68 | /** |
||
69 | * @return string |
||
70 | */ |
||
71 | public function basePath() |
||
75 | |||
76 | /** |
||
77 | * @param \Spires\Core\ServiceProvider|string $provider |
||
78 | * @param array $config |
||
79 | * @param bool $force |
||
80 | * @return ServiceProvider |
||
81 | */ |
||
82 | public function register($provider, array $config = [], $force = false) |
||
112 | |||
113 | /** |
||
114 | * Register all of the base service providers. |
||
115 | * |
||
116 | * @return void |
||
117 | */ |
||
118 | public function registerBaseServiceProviders() |
||
126 | |||
127 | /** |
||
128 | * Get the service providers that have been loaded. |
||
129 | * |
||
130 | * @return array |
||
131 | */ |
||
132 | public function getLoadedProviders() |
||
136 | |||
137 | /** |
||
138 | * Get all plugins. |
||
139 | * |
||
140 | * @return array |
||
141 | */ |
||
142 | public function getPlugins() |
||
146 | |||
147 | /** |
||
148 | * Boot the application's service providers. |
||
149 | * |
||
150 | * @return void |
||
151 | */ |
||
152 | public function boot() |
||
164 | |||
165 | /** |
||
166 | * Determine if the application has booted. |
||
167 | * |
||
168 | * @return bool |
||
169 | */ |
||
170 | public function isBooted() |
||
174 | |||
175 | /** |
||
176 | * Register the basic bindings into the container. |
||
177 | * |
||
178 | * @return void |
||
179 | */ |
||
180 | protected function registerBaseBindings() |
||
187 | |||
188 | /** |
||
189 | * Set the base path for the application. |
||
190 | * |
||
191 | * @param string $basePath |
||
192 | * @return $this |
||
193 | */ |
||
194 | protected function setBasePath($basePath) |
||
202 | |||
203 | /** |
||
204 | * Bind all of the application paths in the container. |
||
205 | * |
||
206 | * @return void |
||
207 | */ |
||
208 | protected function bindPathsInContainer() |
||
212 | |||
213 | /** |
||
214 | * Get the registered service provider instance if it exists. |
||
215 | * |
||
216 | * @param \Spires\Core\ServiceProvider|string $provider |
||
217 | * @return \Spires\Core\ServiceProvider|null |
||
218 | */ |
||
219 | protected function getProvider($provider) |
||
231 | |||
232 | /** |
||
233 | * Resolve a service provider instance from the class name. |
||
234 | * |
||
235 | * @param string $provider |
||
236 | * @return \Spires\Core\ServiceProvider |
||
237 | */ |
||
238 | protected function resolveProviderClass($provider) |
||
242 | |||
243 | /** |
||
244 | * Mark the given provider as registered. |
||
245 | * |
||
246 | * @param \Spires\Core\ServiceProvider $provider |
||
247 | * @return void |
||
248 | */ |
||
249 | protected function markAsRegistered($provider) |
||
254 | |||
255 | /** |
||
256 | * Add plugins from the service provider. |
||
257 | * |
||
258 | * @param \Spires\Core\ServiceProvider $provider |
||
259 | * @return void |
||
260 | */ |
||
261 | protected function addPlugins($provider) |
||
267 | |||
268 | /** |
||
269 | * Register the given service provider. |
||
270 | * |
||
271 | * @param \Spires\Core\ServiceProvider $provider |
||
272 | * @param array $config |
||
273 | * @return mixed |
||
274 | * |
||
275 | * @throws \Spires\Contracts\Core\UndefinedConfigKeyException |
||
276 | */ |
||
277 | protected function registerConfig(ServiceProvider $provider, array $config) |
||
293 | |||
294 | /** |
||
295 | * Register the given service provider. |
||
296 | * |
||
297 | * @param \Spires\Core\ServiceProvider $provider |
||
298 | * @return mixed |
||
299 | */ |
||
300 | protected function registerProvider(ServiceProvider $provider) |
||
306 | |||
307 | /** |
||
308 | * Boot the given service provider. |
||
309 | * |
||
310 | * @param \Spires\Core\ServiceProvider $provider |
||
311 | * @return mixed |
||
312 | */ |
||
313 | protected function bootProvider(ServiceProvider $provider) |
||
319 | } |
||
320 |
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.