Item::setLabel()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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