1 | <?php |
||
16 | class Magister extends Container implements ApplicationContract |
||
17 | { |
||
18 | /** |
||
19 | * The API version. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | const VERSION = '2.1.6'; |
||
24 | |||
25 | /** |
||
26 | * Indicates if the application has been bootstrapped before. |
||
27 | * |
||
28 | * @var bool |
||
29 | */ |
||
30 | protected $hasBeenBootstrapped = false; |
||
31 | |||
32 | /** |
||
33 | * Indicates if the application has "booted". |
||
34 | * |
||
35 | * @var bool |
||
36 | */ |
||
37 | protected $booted = false; |
||
38 | |||
39 | /** |
||
40 | * All of the registered service providers. |
||
41 | * |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $serviceProviders = []; |
||
45 | |||
46 | /** |
||
47 | * Create a new Magister instance. |
||
48 | * |
||
49 | * @param string $school |
||
50 | * @param string $username |
||
51 | * @param string $password |
||
52 | */ |
||
53 | public function __construct($school, $username = null, $password = null) |
||
63 | |||
64 | /** |
||
65 | * Get the version number of the application. |
||
66 | * |
||
67 | * @return string |
||
68 | */ |
||
69 | public function version() |
||
73 | |||
74 | /** |
||
75 | * Register the basic bindings into the container. |
||
76 | * |
||
77 | * @param string $school |
||
78 | * @param string $username |
||
79 | * @param string $password |
||
80 | * |
||
81 | * @return void |
||
82 | */ |
||
83 | protected function registerBaseBindings($school, $username, $password) |
||
93 | |||
94 | /** |
||
95 | * Run the given array of bootstrap classes. |
||
96 | * |
||
97 | * @param array $bootstrappers |
||
98 | * |
||
99 | * @return void |
||
100 | */ |
||
101 | public function bootstrapWith(array $bootstrappers) |
||
109 | |||
110 | /** |
||
111 | * Determine if the application has been bootstrapped before. |
||
112 | * |
||
113 | * @return bool |
||
114 | */ |
||
115 | public function hasBeenBootstrapped() |
||
119 | |||
120 | /** |
||
121 | * Bind all of the application paths in the container. |
||
122 | * |
||
123 | * @return void |
||
124 | */ |
||
125 | protected function bindPathsInContainer() |
||
131 | |||
132 | /** |
||
133 | * Get the base path of the Magister installation. |
||
134 | * |
||
135 | * @return string |
||
136 | */ |
||
137 | public function basePath() |
||
141 | |||
142 | /** |
||
143 | * Get the path to the application configuration files. |
||
144 | * |
||
145 | * @return string |
||
146 | */ |
||
147 | public function configPath() |
||
151 | |||
152 | /** |
||
153 | * Boot the application's service providers. |
||
154 | * |
||
155 | * @return void |
||
156 | */ |
||
157 | public function boot() |
||
169 | |||
170 | /** |
||
171 | * Boot the given service provider. |
||
172 | * |
||
173 | * @param \Magister\Services\Support\ServiceProvider $provider |
||
174 | * |
||
175 | * @return void |
||
176 | */ |
||
177 | protected function bootProvider(ServiceProvider $provider) |
||
183 | |||
184 | /** |
||
185 | * Determine if the application has booted. |
||
186 | * |
||
187 | * @return bool |
||
188 | */ |
||
189 | public function isBooted() |
||
193 | |||
194 | /** |
||
195 | * Get the configuration loader instance. |
||
196 | * |
||
197 | * @return \Magister\Services\Config\LoaderInterface |
||
198 | */ |
||
199 | public function getConfigLoader() |
||
203 | |||
204 | /** |
||
205 | * Register all of the configured providers. |
||
206 | * |
||
207 | * @return void |
||
208 | */ |
||
209 | public function registerProviders() |
||
213 | |||
214 | /** |
||
215 | * Register a service provider with the application. |
||
216 | * |
||
217 | * @param \Magister\Services\Support\ServiceProvider $provider |
||
218 | * @param array $options |
||
219 | * |
||
220 | * @return \Magister\Services\Support\ServiceProvider |
||
221 | */ |
||
222 | public function register(ServiceProvider $provider, $options = []) |
||
238 | |||
239 | /** |
||
240 | * Get the registered service provider instance if it exists. |
||
241 | * |
||
242 | * @param \Magister\Services\Support\ServiceProvider|string $provider |
||
243 | * |
||
244 | * @return \Magister\Services\Support\ServiceProvider|null |
||
245 | */ |
||
246 | public function getProvider($provider) |
||
254 | |||
255 | /** |
||
256 | * Resolve a service provider instance from the class name. |
||
257 | * |
||
258 | * @param string $provider |
||
259 | * |
||
260 | * @return \Magister\Services\Support\ServiceProvider |
||
261 | */ |
||
262 | public function resolveProviderClass($provider) |
||
266 | |||
267 | /** |
||
268 | * Set the school for every request. |
||
269 | * |
||
270 | * @param string $school |
||
271 | * |
||
272 | * @return void |
||
273 | */ |
||
274 | protected function setSchool($school) |
||
278 | |||
279 | /** |
||
280 | * Set the credentials used by the authentication service. |
||
281 | * |
||
282 | * @param string $username |
||
283 | * @param string $password |
||
284 | * |
||
285 | * @return void |
||
286 | */ |
||
287 | protected function setCredentials($username, $password) |
||
291 | |||
292 | /** |
||
293 | * Mark the given provider as registered. |
||
294 | * |
||
295 | * @param \Magister\Services\Support\ServiceProvider $provider |
||
296 | * |
||
297 | * @return void |
||
298 | */ |
||
299 | protected function markAsRegistered($provider) |
||
303 | } |
||
304 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: