QueryManagerController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 41
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubscribedEvents() 0 6 1
A __construct() 0 4 1
A onWbmQueryManagerController() 0 12 1
1
<?php
2
/**
3
 * Query 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 WbmQueryManager\Subscriber\Backend;
18
19
use Enlight\Event\SubscriberInterface;
20
use Shopware\Components\DependencyInjection\Container;
21
22
/**
23
 * Class QueryManagerController
24
 * @package WbmQueryManager\Subscriber\Backend
25
 */
26
class QueryManagerController implements SubscriberInterface
27
{
28
    /**
29
     * @var Container
30
     */
31
    private $container;
32
33
    /**
34
     * @return array
35
     */
36
    public static function getSubscribedEvents()
37
    {
38
        return [
39
            'Enlight_Controller_Dispatcher_ControllerPath_Backend_WbmQueryManager' => 'onWbmQueryManagerController'
40
        ];
41
    }
42
43
    /**
44
     * @param Container $container
45
     */
46
    public function __construct(Container $container)
47
    {
48
        $this->container = $container;
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function onWbmQueryManagerController()
55
    {
56
        $this->container->get('template')->addTemplateDir(
57
            $this->container->getParameter('wbm_query_manager.plugin_dir') . '/Resources/views/'
58
        );
59
60
        $this->container->get('snippets')->addConfigDir(
61
            $this->container->getParameter('wbm_query_manager.plugin_dir') . '/Resources/snippets/'
62
        );
63
64
        return $this->container->getParameter('wbm_query_manager.plugin_dir') . '/Controllers/Backend/WbmQueryManager.php';
65
    }
66
}