Module::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 8
cts 8
cp 1
rs 9.4285
cc 1
eloc 7
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * Polder Knowledge / PhpSettingsModule (https://polderknowledge.com)
4
 *
5
 * @link https://github.com/polderknowledge/phpsettings-module for the canonical source repository
6
 * @copyright Copyright (c) 2002-2016 Polder Knowledge (https://www.polderknowledge.com)
7
 * @license https://github.com/polderknowledge/phpsettings-module/blob/master/LICENSE.md MIT
8
 */
9
10
namespace PolderKnowledge\PhpSettingsModule;
11
12
use PolderKnowledge\PhpSettingsModule\Listener\PhpSettings;
13
use Zend\ModuleManager\ModuleManager;
14
use Zend\Mvc\Application;
15
use Zend\Mvc\MvcEvent;
16
17
/**
18
 * The module class that handles the setting of PHP configuration options.
19
 */
20
class Module
21
{
22
    /**
23
     * Gets the autoloader for this module.
24
     *
25
     * @return array
26
     */
27 3
    public function getAutoloaderConfig()
28
    {
29
        return [
30
            'Zend\Loader\StandardAutoloader' => [
31
                'namespaces' => [
32 3
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
33 3
                ],
34 3
            ],
35 3
        ];
36
    }
37
38
    /**
39
     * Gets the configuration of this module.
40
     *
41
     * @return array
42
     */
43 3
    public function getConfig()
44
    {
45 3
        return include __DIR__ . '/../config/module.config.php';
46
    }
47
48
    /**
49
     * Initializes the module.
50
     *
51
     * @param ModuleManager $moduleManager The module manager that is used by Zend Framework.
52
     */
53 3
    public function init(ModuleManager $moduleManager)
54
    {
55 3
        $sharedManager = $moduleManager->getEventManager()->getSharedManager();
56 3
        $sharedManager->attach(
57 1
            Application::class,
58 3
            MvcEvent::EVENT_BOOTSTRAP,
59 3
            [new PhpSettings, 'onBootstrap'],
60
            PHP_INT_MAX
61 3
        );
62 3
    }
63
}
64