Module::getConfig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace MaglMarkdown;
4
5
use MaglMarkdown\Cache\CacheListener;
6
use Zend\ModuleManager\Feature;
7
use Zend\Mvc\MvcEvent;
8
9
/**
10
 * MaglMarkdown is a ZF2 module to provide a View Helper that is able to
11
 * transform Markdown to html
12
 *
13
 * @author Matthias Glaub <[email protected]>
14
 */
15
class Module implements
16
    Feature\AutoloaderProviderInterface,
17
    Feature\ConfigProviderInterface,
18
    Feature\ViewHelperProviderInterface
19
{
20
21 1
    public function onBootstrap(MvcEvent $e)
22
    {
23
        // attach the cache listener, if caching is enabled
24 1
        $sm = $e->getApplication()->getServiceManager();
25 1
        $config = $sm->get('config');
26 1
        if ($config['magl_markdown']['cache_enabled']) {
27 1
            $em = $e->getApplication()->getEventManager();
28
            /** @var CacheListener $listener */
29 1
            $listener = $sm->get('MaglMarkdown\CacheListener');
30 1
            $listener->attach($em);
31
        }
32 1
    }
33
34
    /**
35
     * @return array
36
     */
37 4
    public function getConfig()
38
    {
39 4
        return include __DIR__ . '/../../config/module.config.php';
40
    }
41
42
    /**
43
     * @return array
44
     */
45 1
    public function getAutoloaderConfig()
46
    {
47
        return array(
48 1
            'Zend\Loader\StandardAutoloader' => array(
49
                'namespaces' => array(
50
                    __NAMESPACE__ => __DIR__,
51
                ),
52
            ),
53
        );
54
    }
55
56
    /**
57
     * @return array
58
     */
59 1
    public function getViewHelperConfig()
60
    {
61
        return array(
62 1
            'aliases' => array(
63
                'markdown' => 'MaglMarkdown\View\Helper\Markdown',
64
            ),
65
            'factories' => array(
66
                'MaglMarkdown\View\Helper\Markdown' => 'MaglMarkdown\View\Helper\MarkdownFactory',
67
            ),
68
        );
69
    }
70
}
71