Module   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 17
c 2
b 0
f 0
dl 0
loc 38
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfig() 0 6 1
A init() 0 20 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arp\LaminasDoctrine;
6
7
use Arp\LaminasDoctrine\Console\Module\CommandManager;
8
use Arp\LaminasDoctrine\Console\Module\Feature\CommandConfigProviderInterface;
9
use Arp\LaminasDoctrine\Console\Module\Feature\HelperConfigProviderInterface;
10
use Arp\LaminasDoctrine\Console\Module\HelperManager;
11
use Laminas\ModuleManager\Listener\ServiceListenerInterface;
12
use Laminas\ModuleManager\ModuleManager;
13
use Psr\Container\ContainerExceptionInterface;
14
use Psr\Container\ContainerInterface;
15
use Psr\Container\NotFoundExceptionInterface;
16
17
final class Module
18
{
19
    /**
20
     * @throws ContainerExceptionInterface
21
     * @throws NotFoundExceptionInterface
22
     */
23
    public function init(ModuleManager $moduleManager): void
24
    {
25
        /** @var ContainerInterface $serviceManager */
26
        $serviceManager = $moduleManager->getEvent()->getParam('ServiceManager');
27
28
        /** @var ServiceListenerInterface $serviceListener */
29
        $serviceListener = $serviceManager->get('ServiceListener');
30
31
        $serviceListener->addServiceManager(
32
            CommandManager::class,
33
            'arp_console_command_manager',
34
            CommandConfigProviderInterface::class,
35
            'getConsoleCommandManagerConfig'
36
        );
37
38
        $serviceListener->addServiceManager(
39
            HelperManager::class,
40
            'arp_console_helper_manager',
41
            HelperConfigProviderInterface::class,
42
            'getConsoleHelperManagerConfig'
43
        );
44
    }
45
46
    /**
47
     * @return array<mixed>
48
     */
49
    public function getConfig(): array
50
    {
51
        return array_replace_recursive(
52
            require __DIR__ . '/../config/doctrine.config.php',
53
            require __DIR__ . '/../config/console.config.php',
54
            require __DIR__ . '/../config/module.config.php'
55
        );
56
    }
57
}
58