Entry::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php
2
3
namespace CarlosIO\Geckoboard\Data\Funnel;
4
5
/**
6
 * Class Entry.
7
 */
8
class Entry
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $value;
14
15
    /**
16
     * @var string
17
     */
18
    protected $label;
19
20 1
    public function __construct()
21
    {
22 1
        $this->value = null;
23 1
        $this->label = null;
24 1
    }
25
26
    /**
27
     * @param $value
28
     *
29
     * @return $this
30
     */
31 1
    public function setValue($value)
32
    {
33 1
        $this->value = $value;
34
35 1
        return $this;
36
    }
37
38
    /**
39
     * @param  $label
40
     *
41
     * @return $this
42
     */
43 1
    public function setLabel($label)
44
    {
45 1
        $this->label = $label;
46
47 1
        return $this;
48
    }
49
50
    /**
51
     * @return string
52
     */
53 1
    public function getLabel()
54
    {
55 1
        return $this->label;
56
    }
57
58
    /**
59
     * @return string
60
     */
61 1
    public function getValue()
62
    {
63 1
        return $this->value;
64
    }
65
66
    /**
67
     * @return array
68
     */
69 1
    public function toArray()
70
    {
71 1
        $result = array();
72
73 1
        $value = $this->getValue();
74 1
        if (null !== $value) {
75 1
            $result['value'] = (string) $value;
76 1
        }
77
78 1
        $label = $this->getLabel();
79 1
        if (null !== $label) {
80 1
            $result['label'] = $label;
81 1
        }
82
83 1
        return $result;
84
    }
85
}
86