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

Script   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 0
cbo 1
dl 0
loc 27
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 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