ItemList   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 2 Features 1
Metric Value
wmc 3
c 4
b 2
f 1
lcom 1
cbo 3
dl 0
loc 24
ccs 10
cts 10
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addItem() 0 11 2
A getData() 0 4 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