PieChart::addEntry()   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 1
Metric Value
c 1
b 0
f 1
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\Widgets;
4
5
/**
6
 * Class PieChart.
7
 */
8
class PieChart extends Widget
9
{
10
    protected $dataset = array();
11
12 1
    public function addEntry($entry)
13
    {
14 1
        $this->dataset[] = $entry;
15
16 1
        return $this;
17
    }
18
19 1
    public function getData()
20
    {
21 1
        $data = array();
22 1
        foreach ($this->dataset as $entry) {
23 1
            $data[] = $entry->toArray();
24 1
        }
25
26 1
        $result = array();
27
28 1
        $result['item'] = $data;
29
30 1
        return $result;
31
    }
32
}
33