Completed
Pull Request — master (#1)
by Walter
02:59
created

Script   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 4 1
1
<?php
2
/**
3
 * This file is part of phpab/phpab-module. (https://github.com/phpab/phpab-module)
4
 *
5
 * @link https://github.com/phpab/phpab-module for the canonical source repository
6
 * @copyright Copyright (c) 2015-2016 phpab. (https://github.com/phpab/)
7
 * @license https://raw.githubusercontent.com/phpab/phpab-module/master/LICENSE MIT
8
 */
9
10
namespace PhpAbModule\View\Helper;
11
12
use PhpAb\Analytics\Renderer\AbstractGoogleAnalytics;
13
use Zend\View\Helper\AbstractHelper;
14
15
/**
16
 * A view helper that can be used to render a script for analytics.
17
 */
18
class Script extends AbstractHelper
19
{
20
    private $analytics;
21
22
    /**
23
     * Initializes a new instance of this class.
24
     *
25
     * @param AbstractGoogleAnalytics $analytics The analytics to render a script for.
26
     */
27
    public function __construct(AbstractGoogleAnalytics $analytics)
28
    {
29
        $this->analytics = $analytics;
30
    }
31
32
    /**
33
     * Generates the script that is needed to make phpab work.
34
     *
35
     * @return string
36
     */
37
    public function __invoke()
38
    {
39
        return $this->analytics->getScript();
40
    }
41
}
42