Map   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A addPoint() 0 6 1
A getData() 0 9 2
A __construct() 0 4 1
A getPoints() 0 4 1
1
<?php
2
3
namespace CarlosIO\Geckoboard\Widgets;
4
5
use CarlosIO\Geckoboard\Data\Point;
6
7
/**
8
 * Class Map.
9
 */
10
class Map extends Widget
11
{
12
    /**
13
     * @var array
14
     */
15
    protected $dataset;
16
17 3
    public function __construct()
18
    {
19 3
        $this->dataset = array();
20 3
    }
21
22
    /**
23
     * @return array
24
     */
25 1
    public function getPoints()
26
    {
27 1
        return $this->dataset;
28
    }
29
30
    /**
31
     * @param Point $point
32
     *
33
     * @return $this
34
     */
35 2
    public function addPoint(Point $point)
36
    {
37 2
        $this->dataset[] = $point;
38
39 2
        return $this;
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45 2
    public function getData()
46
    {
47 2
        $result = array();
48 2
        foreach ($this->dataset as $point) {
49 2
            $result[] = $point->toArray();
50 2
        }
51
52 2
        return array('points' => array('point' => $result));
53
    }
54
}
55