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