Completed
Push — master ( af9165...d0edb0 )
by Sergei
01:22
created

ClientDiServiceDefinitionsProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
B getItems() 0 44 2
1
<?php
2
3
namespace Modera\BackendGoogleAnalyticsBundle\Contributions;
4
5
use Sli\ExpanderBundle\Ext\ContributorInterface;
6
7
/**
8
 * Contributes a plugin to MJR that would allow to track page views.
9
 *
10
 * @internal
11
 *
12
 * @author    Sergei Lissovski <[email protected]>
13
 * @copyright 2016 Modera Foundation
14
 */
15
class ClientDiServiceDefinitionsProvider implements ContributorInterface
16
{
17
    /** @var boolean $enabled */
18
    private $enabled;
19
20
    /**
21
     * @param $enabled
22
     */
23
    public function __construct($enabled)
24
    {
25
        $this->enabled = $enabled;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function getItems()
32
    {
33
        $items = array(
34
            'modera_backend_google_analytics.runtime.tracking_injection_plugin' => array(
35
                'className' => 'Modera.backend.googleanalytics.runtime.TrackingInjectionPlugin',
36
                'args' => [
37
                    array(
38
                        'executionContext' => '@root_execution_context',
39
                        'configProvider' => '@config_provider',
40
                    ),
41
                ],
42
                'tags' => ['runtime_plugin'],
43
            ),
44
            'modera_backend_google_analytics.profiling.ga_backend' => array(
45
                'className' => 'Modera.backend.googleanalytics.profiling.GABackend',
46
                'args' => [
47
                    array(
48
                        'trackingPlugin' => '@modera_backend_google_analytics.runtime.tracking_injection_plugin',
49
                    ),
50
                ],
51
                'tags' => [
52
                    'profiler_backend',
53
                ],
54
            ),
55
            'activity_profiling_auto_start_plugin' => array(
56
                'className' => 'MF.profiling.ActivityProfilingAutoStartPlugin',
57
                'args' => [
58
                    array(
59
                        'workbench' => '@workbench',
60
                        'profiler' => '@profiler',
61
                    ),
62
                ],
63
                'tags' => [
64
                    'runtime_plugin',
65
                ],
66
            ),
67
        );
68
69
        if (!$this->enabled) {
70
            $items = array();
71
        }
72
73
        return $items;
74
    }
75
}
76