1 | <?php |
||
10 | class Component extends ComponentServiceProvider |
||
11 | { |
||
12 | /** |
||
13 | * The laravel application instance. |
||
14 | * |
||
15 | * @var Application |
||
16 | */ |
||
17 | protected $app; |
||
18 | |||
19 | /** |
||
20 | * The component name. |
||
21 | * |
||
22 | * @var |
||
23 | */ |
||
24 | protected $name; |
||
25 | |||
26 | /** |
||
27 | * The component path,. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $path; |
||
32 | |||
33 | /** |
||
34 | * The constructor. |
||
35 | * |
||
36 | * @param Application $app |
||
37 | * @param $name |
||
38 | * @param $path |
||
39 | */ |
||
40 | public function __construct(Application $app, $name, $path) |
||
46 | |||
47 | /** |
||
48 | * Get laravel instance. |
||
49 | * |
||
50 | * @return \Illuminate\Foundation\Application |
||
51 | */ |
||
52 | public function getLaravel() |
||
56 | |||
57 | /** |
||
58 | * Get name. |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | public function getName() |
||
66 | |||
67 | /** |
||
68 | * Get name in lower case. |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | public function getLowerName() |
||
76 | |||
77 | /** |
||
78 | * Get name in studly case. |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | public function getStudlyName() |
||
86 | |||
87 | /** |
||
88 | * Get description. |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | public function getDescription() |
||
96 | |||
97 | /** |
||
98 | * Get alias. |
||
99 | * |
||
100 | * @return string |
||
101 | */ |
||
102 | public function getAlias() |
||
106 | |||
107 | /** |
||
108 | * Get priority. |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | public function getPriority() |
||
116 | |||
117 | /** |
||
118 | * Get path. |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | public function getPath() |
||
126 | |||
127 | /** |
||
128 | * Set path. |
||
129 | * |
||
130 | * @param string $path |
||
131 | * |
||
132 | * @return $this |
||
133 | */ |
||
134 | public function setPath($path) |
||
140 | |||
141 | /** |
||
142 | * Bootstrap the application events. |
||
143 | */ |
||
144 | public function boot() |
||
152 | |||
153 | /** |
||
154 | * Register component's translation. |
||
155 | * |
||
156 | * @return void |
||
157 | */ |
||
158 | protected function registerTranslation() |
||
168 | |||
169 | /** |
||
170 | * Get json contents. |
||
171 | * |
||
172 | * @return Json |
||
173 | */ |
||
174 | public function json($file = null) |
||
182 | |||
183 | /** |
||
184 | * Get a specific data from json file by given the key. |
||
185 | * |
||
186 | * @param $key |
||
187 | * @param null $default |
||
188 | * |
||
189 | * @return mixed |
||
190 | */ |
||
191 | public function get($key, $default = null) |
||
195 | |||
196 | /** |
||
197 | * Get a specific data from composer.json file by given the key. |
||
198 | * |
||
199 | * @param $key |
||
200 | * @param null $default |
||
201 | * |
||
202 | * @return mixed |
||
203 | */ |
||
204 | public function getComposerAttr($key, $default = null) |
||
208 | |||
209 | /** |
||
210 | * Register the component. |
||
211 | */ |
||
212 | public function register() |
||
222 | |||
223 | /** |
||
224 | * Register the component event. |
||
225 | * |
||
226 | * @param string $event |
||
227 | */ |
||
228 | protected function fireEvent($event) |
||
232 | |||
233 | /** |
||
234 | * Register the aliases from this component. |
||
235 | */ |
||
236 | protected function registerAliases() |
||
243 | |||
244 | /** |
||
245 | * Register the service providers from this component. |
||
246 | */ |
||
247 | protected function registerProviders() |
||
253 | |||
254 | /** |
||
255 | * Register the files from this component. |
||
256 | */ |
||
257 | protected function registerFiles() |
||
263 | |||
264 | /** |
||
265 | * Handle call __toString. |
||
266 | * |
||
267 | * @return string |
||
268 | */ |
||
269 | public function __toString() |
||
273 | |||
274 | /** |
||
275 | * Determine whether the given status same with the current component status. |
||
276 | * |
||
277 | * @param $status |
||
278 | * |
||
279 | * @return bool |
||
280 | */ |
||
281 | public function isStatus($status) |
||
285 | |||
286 | /** |
||
287 | * Determine whether the current component activated. |
||
288 | * |
||
289 | * @return bool |
||
290 | */ |
||
291 | public function enabled() |
||
295 | |||
296 | /** |
||
297 | * Alternate for "enabled" method. |
||
298 | * |
||
299 | * @return bool |
||
300 | */ |
||
301 | public function active() |
||
305 | |||
306 | /** |
||
307 | * Determine whether the current component not activated. |
||
308 | * |
||
309 | * @return bool |
||
310 | */ |
||
311 | public function notActive() |
||
315 | |||
316 | /** |
||
317 | * Alias for "notActive" method. |
||
318 | * |
||
319 | * @return bool |
||
320 | */ |
||
321 | public function disabled() |
||
325 | |||
326 | /** |
||
327 | * Set active state for current component. |
||
328 | * |
||
329 | * @param $active |
||
330 | * |
||
331 | * @return bool |
||
332 | */ |
||
333 | public function setActive($active) |
||
337 | |||
338 | /** |
||
339 | * Disable the current component. |
||
340 | * |
||
341 | * @return bool |
||
342 | */ |
||
343 | public function disable() |
||
351 | |||
352 | /** |
||
353 | * Enable the current component. |
||
354 | */ |
||
355 | public function enable() |
||
363 | |||
364 | /** |
||
365 | * Delete the current component. |
||
366 | * |
||
367 | * @return bool |
||
368 | */ |
||
369 | public function delete() |
||
373 | |||
374 | /** |
||
375 | * Get extra path. |
||
376 | * |
||
377 | * @param $path |
||
378 | * |
||
379 | * @return string |
||
380 | */ |
||
381 | public function getExtraPath($path) |
||
385 | |||
386 | /** |
||
387 | * Handle call to __get method. |
||
388 | * |
||
389 | * @param $key |
||
390 | * |
||
391 | * @return mixed |
||
392 | */ |
||
393 | public function __get($key) |
||
397 | } |
||
398 |