Total Complexity | 6 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | trait LoadsSubmodules |
||
20 | { |
||
21 | use HasModuleConfig; |
||
22 | |||
23 | private function loadSubModules(array $modules): void |
||
24 | { |
||
25 | foreach ($modules as $module => $configuration) { |
||
26 | if (is_int($module) && is_string($configuration)) { // means no configuration was set for module |
||
27 | $module = $configuration; |
||
28 | $configuration = $this->getDefaultSubModuleConfiguration(); |
||
29 | } else { |
||
30 | $configuration = array_merge( |
||
31 | $this->getDefaultSubModuleConfiguration(), |
||
32 | is_array($configuration) ? $configuration : [] |
||
33 | ); |
||
34 | $configuration = array_replace_recursive($configuration, $this->getCascadeModuleConfiguration()); |
||
35 | } |
||
36 | |||
37 | $this->concord->registerModule($module, $configuration); |
||
38 | } |
||
39 | } |
||
40 | |||
41 | #[ArrayShape(['implicit' => "bool", 'migrations' => "mixed", 'views' => "mixed", 'routes' => "mixed"])] private function getDefaultSubModuleConfiguration(): array |
||
48 | ]; |
||
49 | } |
||
51 |