PostDispatch   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 0
cbo 0
dl 0
loc 40
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubscribedEvents() 0 7 1
A __construct() 0 4 1
A onPostDispatch() 0 8 1
1
<?php
2
/**
3
 * Template Manager
4
 * Copyright (c) Webmatch GmbH
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 */
16
17
namespace WbmTemplateManager\Subscriber\Frontend;
18
19
use Enlight\Event\SubscriberInterface;
20
use Shopware\Components\DependencyInjection\Container;
21
22
/**
23
 * Class PostDispatch
24
 * @package WbmTemplateManager\Subscriber\Backend
25
 */
26
class PostDispatch implements SubscriberInterface
27
{
28
29
    /**
30
     * @var Container
31
     */
32
    private $container;
33
34
    /**
35
     * @return array
36
     */
37
    public static function getSubscribedEvents()
38
    {
39
        return [
40
            'Enlight_Controller_Action_PostDispatch_Frontend' => 'onPostDispatch',
41
            'Enlight_Controller_Action_PostDispatch_Widgets' => 'onPostDispatch'
42
        ];
43
    }
44
45
    /**
46
     * PostDispatch constructor.
47
     * @param Container $container
48
     */
49
    public function __construct(Container $container)
50
    {
51
        $this->container = $container;
52
    }
53
54
    /**
55
     * @param \Enlight_Event_EventArgs $args
56
     */
57
    public function onPostDispatch(\Enlight_Event_EventArgs $args)
58
    {
59
        $view = $args->getSubject()->View();
60
61
        $view->addTemplateDir(
62
            $this->container->getParameter('wbm_template_manager.plugin_dir') . '/Resources/views/responsive/'
63
        );
64
    }
65
}