Completed
Push — master ( 5cf5b8...189f41 )
by Andreas
05:29 queued 05:22
created

Module::initializeConsole()   B

Complexity

Conditions 5
Paths 16

Size

Total Lines 73
Code Lines 51

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 54
CRAP Score 5.0001

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 73
ccs 54
cts 55
cp 0.9818
rs 8.5021
cc 5
eloc 51
nc 16
nop 1
crap 5.0001

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/*
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the MIT license. For more information, see
17
 * <http://www.doctrine-project.org>.
18
 */
19
20
namespace DoctrineORMModule;
21
22
use DoctrineORMModule\Listener\PostCliLoadListener;
23
use Zend\ModuleManager\Feature\ControllerProviderInterface;
24
use Zend\ModuleManager\Feature\ConfigProviderInterface;
25
use Zend\ModuleManager\Feature\InitProviderInterface;
26
use Zend\ModuleManager\Feature\DependencyIndicatorInterface;
27
use Zend\ModuleManager\ModuleManagerInterface;
28
29
/**
30
 * Base module for Doctrine ORM.
31
 *
32
 * @license MIT
33
 * @link    www.doctrine-project.org
34
 * @author  Kyle Spraggs <[email protected]>
35
 * @author  Marco Pivetta <[email protected]>
36
 */
37
class Module implements
38
    ControllerProviderInterface,
39
    ConfigProviderInterface,
40
    InitProviderInterface,
41
    DependencyIndicatorInterface
42
{
43
    /**
44
     * {@inheritDoc}
45
     */
46 72
    public function init(ModuleManagerInterface $manager)
47
    {
48 72
        $events = $manager->getEventManager();
49 72
        $serviceManager = $manager->getEvent()->getParam('ServiceManager');
0 ignored issues
show
Bug introduced by
The method getEvent() does not exist on Zend\ModuleManager\ModuleManagerInterface. Did you maybe mean getEventManager()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
50
51
        // Initialize logger collector once the profiler is initialized itself
52 72
        $events->attach(
53 72
            'profiler_init',
54
            function () use ($serviceManager) {
55
                $serviceManager->get('doctrine.sql_logger_collector.orm_default');
56
            }
57 72
        );
58
59
        /* @var $postCliLoadListener PostCliLoadListener */
60 72
        $postCliLoadListener = $serviceManager->get(PostCliLoadListener::class);
61 72
        $postCliLoadListener->attach($events);
62 72
    }
63
64
    /**
65
     * {@inheritDoc}
66
     */
67 72
    public function getConfig()
68
    {
69 72
        return include __DIR__ . '/../../config/module.config.php';
70
    }
71
72
    /**
73
     * {@inheritDoc}
74
     */
75 72
    public function getControllerConfig()
76
    {
77 72
        return include __DIR__ . '/../../config/controllers.config.php';
78
    }
79
80
    /**
81
     * {@inheritDoc}
82
     */
83 72
    public function getModuleDependencies()
84
    {
85 72
        return ['DoctrineModule'];
86
    }
87
}
88