Entry::toArray()   A
last analyzed

Complexity

Conditions 4
Paths 8

Size

Total Lines 20
Code Lines 12

Duplication

Lines 20
Ratio 100 %

Code Coverage

Tests 15
CRAP Score 4

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 20
loc 20
ccs 15
cts 15
cp 1
rs 9.2
cc 4
eloc 12
nc 8
nop 0
crap 4
1
<?php
2
3
namespace CarlosIO\Geckoboard\Data;
4
5
/**
6
 * Class Entry.
7
 */
8
class Entry
9
{
10
    /**
11
     * @var
12
     */
13
    protected $value = null;
14
    /**
15
     * @var
16
     */
17
    protected $text = null;
18
    /**
19
     * @var
20
     */
21
    protected $prefix = null;
22
23
    /**
24
     * @param $prefix
25
     *
26
     * @return $this
27
     */
28 2
    public function setPrefix($prefix)
29
    {
30 2
        $this->prefix = $prefix;
31
32 2
        return $this;
33
    }
34
35
    /**
36
     * @return mixed
37
     */
38 6
    public function getPrefix()
39
    {
40 6
        return $this->prefix;
41
    }
42
43
    /**
44
     * @param $text
45
     *
46
     * @return $this
47
     */
48 6
    public function setText($text)
49
    {
50 6
        $this->text = $text;
51
52 6
        return $this;
53
    }
54
55
    /**
56
     * @return mixed
57
     */
58 6
    public function getText()
59
    {
60 6
        return $this->text;
61
    }
62
63
    /**
64
     * @param $value
65
     *
66
     * @return $this
67
     */
68 6
    public function setValue($value)
69
    {
70 6
        $this->value = $value;
71
72 6
        return $this;
73
    }
74
75
    /**
76
     * @return mixed
77
     */
78 6
    public function getValue()
79
    {
80 6
        return $this->value;
81
    }
82
83 6 View Code Duplication
    public function toArray()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
84
    {
85 6
        $result = array();
86 6
        $text = $this->getText();
87 6
        if (null !== $text) {
88 6
            $result['text'] = $text;
89 6
        }
90
91 6
        $value = $this->getValue();
92 6
        if (null !== $value) {
93 6
            $result['value'] = $value;
94 6
        }
95
96 6
        $prefix = $this->getPrefix();
97 6
        if (null !== $prefix) {
98 2
            $result['prefix'] = $prefix;
99 2
        }
100
101 6
        return $result;
102
    }
103
}
104