SingleParameter::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace TheIconic\Tracking\GoogleAnalytics\Parameters;
4
5
use TheIconic\Tracking\GoogleAnalytics\Traits\Indexable;
6
7
/**
8
 * Class SingleParameter
9
 *
10
 * A parameter is composed of a name and a value.
11
 *
12
 * @package TheIconic\Tracking\GoogleAnalytics\Parameters
13
 */
14
abstract class SingleParameter implements SingleParameterInterface
15
{
16
    use Indexable;
17
18
    /**
19
     * Name for a parameter in GA Measurement Protocol.
20
     * Its sent as the name for a query parameter in the HTTP request.
21
     *
22
     * @var string
23
     */
24
    protected $name = '';
25
26
    /**
27
     * Value for the parameter.
28
     *
29
     * @var mixed
30
     */
31
    protected $value;
32
33
    /**
34
     * Indexes the name when necessary.
35
     *
36
     * @param $index
37
     */
38
    public function __construct($index = '')
39
    {
40
        $this->name = $this->addIndex($this->name, $index);
41
    }
42
43
    /**
44
     * @inheritDoc
45
     */
46
    public function getName()
47
    {
48
        return $this->name;
49
    }
50
51
    /**
52
     * @inheritDoc
53
     */
54
    public function setValue($value)
55
    {
56
        $this->value = $value;
57
58
        return $this;
59
    }
60
61
    /**
62
     * @inheritDoc
63
     */
64
    public function getValue()
65
    {
66
        return $this->value;
67
    }
68
}
69