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

Script::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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