Total Complexity | 7 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
15 | abstract class BaseBoxServiceProvider extends BaseServiceProvider |
||
16 | { |
||
17 | protected $configFileName = 'box.php'; |
||
18 | |||
19 | protected static $_kind = 'box'; |
||
20 | |||
21 | public function register() |
||
22 | { |
||
23 | parent::register(); |
||
24 | |||
25 | $modules = $this->config("modules"); |
||
26 | $modules = $modules ?: []; |
||
27 | |||
28 | foreach ($modules as $module => $configuration) { |
||
29 | if (is_int($module) && is_string($configuration)) { // means no configuration was set for module |
||
30 | $module = $configuration; |
||
31 | $configuration = $this->getDefaultModuleConfiguration(); |
||
32 | } else { |
||
33 | $configuration = array_merge($this->getDefaultModuleConfiguration(), |
||
34 | is_array($configuration) ? $configuration : []); |
||
35 | } |
||
36 | |||
37 | $this->concord->registerModule($module, $configuration); |
||
38 | } |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Returns the default configuration settings for modules loaded within boxes |
||
43 | * |
||
44 | * @return array |
||
45 | */ |
||
46 | protected function getDefaultModuleConfiguration() |
||
53 | ]; |
||
54 | } |
||
56 |