1 | <?php declare(strict_types = 1); |
||
16 | abstract class AbstractServiceProvider implements ServiceProvider |
||
17 | { |
||
18 | /** |
||
19 | * Service provider name. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected static $name; |
||
24 | |||
25 | /** |
||
26 | * Application config. |
||
27 | * |
||
28 | * @var Config |
||
29 | */ |
||
30 | private $appConfig; |
||
31 | |||
32 | /** |
||
33 | * Container instance. |
||
34 | * |
||
35 | * @var Container |
||
36 | */ |
||
37 | private $container; |
||
38 | |||
39 | /** |
||
40 | * AbstractServiceProvider constructor. |
||
41 | * |
||
42 | * @param Container $container |
||
43 | * @param Config $appConfig |
||
44 | */ |
||
45 | public function __construct(Container $container, Config $appConfig) |
||
50 | |||
51 | /** |
||
52 | * @inheritdoc |
||
53 | */ |
||
54 | public static function dependencies(): array |
||
55 | { |
||
56 | return []; |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @inheritdoc |
||
61 | */ |
||
62 | final public static function name(): string |
||
63 | { |
||
64 | return static::$name ?: static::class; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @inheritdoc |
||
69 | */ |
||
70 | abstract public function boot(); |
||
71 | |||
72 | /** |
||
73 | * @return Container |
||
74 | */ |
||
75 | protected function container(): Container |
||
79 | |||
80 | /** |
||
81 | * Merges config params from service provider with the global configuration. |
||
82 | * |
||
83 | * @param string[] ...$configFiles |
||
84 | */ |
||
85 | protected function loadConfigFromFiles(string ...$configFiles) |
||
101 | |||
102 | /** |
||
103 | * Registers commands exposed by service provider. |
||
104 | * |
||
105 | * @param string[] ...$commandClasses |
||
106 | */ |
||
107 | protected function provideCommands(string ...$commandClasses) |
||
115 | } |