Completed
Pull Request — master (#1)
by Walter
03:36
created

Script::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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 PhpAb\Analytics\Renderer\RendererInterface;
14
use Zend\View\Helper\AbstractHelper;
15
16
/**
17
 * A view helper that can be used to render a script for analytics.
18
 */
19
class Script extends AbstractHelper
20
{
21
    /**
22
     * @var RendererInterface
23
     */
24
    private $renderer;
25
26
    /**
27
     * Initializes a new instance of this class.
28
     *
29
     * @param RendererInterface $renderer The analytics to render a script for.
30
     */
31
    public function __construct(RendererInterface $renderer)
32
    {
33
        $this->renderer = $renderer;
34
    }
35
36
    /**
37
     * Generates the script that is needed to make phpab work.
38
     *
39
     * @return string
40
     */
41
    public function __invoke()
42
    {
43
        return $this->renderer->getScript();
44
    }
45
}
46