Module::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 14
rs 9.4285
cc 1
eloc 8
nc 1
nop 1
1
<?php
2
/**
3
 * Sake
4
 *
5
 * @link      http://github.com/sandrokeil/CodeGenerator for the canonical source repository
6
 * @copyright Copyright (c) 2014 Sandro Keil
7
 * @license   http://github.com/sandrokeil/CodeGenerator/blob/master/LICENSE.txt New BSD License
8
 */
9
10
namespace Sake\CodeGenerator;
11
12
use Sake\CodeGenerator\Doctrine\ORM\Tools\Console\Command\GenerateFormCommand;
13
use Sake\CodeGenerator\Doctrine\ORM\Tools\Console\Command\GenerateInputFilterCommand;
14
use Zend\ModuleManager\Feature\ConfigProviderInterface;
15
16
/**
17
 * This class initializes the CodeGenerator module.
18
 */
19
class Module implements ConfigProviderInterface
20
{
21
22
    /**
23
     * {@inheritDoc}
24
     */
25
    public function init(ModuleManager $e)
26
    {
27
        $events = $e->getEventManager()->getSharedManager();
28
        // Attach to helper set event and load the entity manager helper.
29
        $events->attach('doctrine', 'loadCli.post', function (EventInterface $e) {
30
            /* @var $cli \Symfony\Component\Console\Application */
31
            $cli = $e->getTarget();
32
            ConsoleRunner::addCommands($cli);
33
            $cli->addCommands(array(
34
                new GenerateFormCommand(),
35
                new GenerateInputFilterCommand()
36
            ));
37
        });
38
    }
39
40
41
    /**
42
     * Expected to return \Zend\ServiceManager\Config object or array to
43
     * seed such an object.
44
     *
45
     * @return array
46
     */
47
    public function getConfig()
48
    {
49
        return require dirname(__DIR__) . '/config/module.config.php';
50
    }
51
}
52