ItemList::getData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 2 Features 0
Metric Value
c 2
b 2
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace CarlosIO\Geckoboard\Widgets;
4
5
use CarlosIO\Geckoboard\Data\ItemList\Label;
6
use CarlosIO\Geckoboard\Data\ItemList\Title;
7
8
/**
9
 * Class ItemList.
10
 */
11
class ItemList extends Widget
12
{
13
    protected $items = array();
14
15 3
    public function addItem(Title $title, $label, $description)
16
    {
17 3
        $count = count($this->items);
18 3
        $this->items[$count]['title'] = $title->toArray();
19
20 3
        if ($label instanceof Label) {
21 2
            $this->items[$count]['label'] = $label->toArray();
22 2
        }
23
24 3
        $this->items[$count]['description'] = $description;
25 3
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 4
    public function getData()
31
    {
32 4
        return $this->items;
33
    }
34
}
35