Completed
Push — master ( c3465a...e27b3b )
by Tom
03:42 queued 15s
created

Module   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 31.58%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 4
c 3
b 0
f 0
lcom 0
cbo 5
dl 0
loc 55
ccs 6
cts 19
cp 0.3158
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A onBootstrap() 0 21 1
A getConfig() 0 4 1
A getControllerConfig() 0 4 1
A getModuleDependencies() 0 4 1
1
<?php
2
3
namespace DoctrineORMModule;
4
5
use DoctrineORMModule\Listener\PostCliLoadListener;
6
use Interop\Container\ContainerInterface;
7
use Zend\EventManager\EventInterface;
8
use Zend\ModuleManager\Feature\BootstrapListenerInterface;
9
use Zend\ModuleManager\Feature\ControllerProviderInterface;
10
use Zend\ModuleManager\Feature\ConfigProviderInterface;
11
use Zend\ModuleManager\Feature\DependencyIndicatorInterface;
12
13
/**
14
 * Base module for Doctrine ORM.
15
 *
16
 * @license MIT
17
 * @link    www.doctrine-project.org
18
 * @author  Kyle Spraggs <[email protected]>
19
 * @author  Marco Pivetta <[email protected]>
20
 */
21
class Module implements
22
    BootstrapListenerInterface,
23
    ControllerProviderInterface,
24
    ConfigProviderInterface,
25
    DependencyIndicatorInterface
26
{
27
    /**
28
     * {@inheritDoc}
29
     */
30
    public function onBootstrap(EventInterface $event)
31
    {
32
        /* @var $application \Zend\Mvc\Application */
33
        $application = $event->getTarget();
34
        /* @var $container ContainerInterface */
35
        $container = $application->getServiceManager();
36
37
        $events = $application->getEventManager();
38
39
        // Initialize logger collector once the profiler is initialized itself
40
        $events->attach(
41
            'profiler_init',
42
            function () use ($container) {
43
                $container->get('doctrine.sql_logger_collector.orm_default');
44
            }
45
        );
46
47
        /* @var $postCliLoadListener PostCliLoadListener */
48
        $postCliLoadListener = $container->get(PostCliLoadListener::class);
49
        $postCliLoadListener->attach($events);
50
    }
51
52
    /**
53
     * {@inheritDoc}
54
     */
55 72
    public function getConfig()
56
    {
57 72
        return include __DIR__ . '/../../config/module.config.php';
58
    }
59
60
    /**
61
     * {@inheritDoc}
62
     */
63 72
    public function getControllerConfig()
64
    {
65 72
        return include __DIR__ . '/../../config/controllers.config.php';
66
    }
67
68
    /**
69
     * {@inheritDoc}
70
     */
71 72
    public function getModuleDependencies()
72
    {
73 72
        return ['DoctrineModule'];
74
    }
75
}
76