Generic   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 73
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getTitle() 0 4 1
A setTitle() 0 4 1
A getIcon() 0 4 2
A setIcon() 0 4 1
A getData() 0 4 1
A setData() 0 4 1
1
<?php
2
/**
3
 * @author @potfur <[email protected]>
4
 * @created 26.02.15, 22:57
5
 */
6
namespace Fabfuel\Prophiler\DataCollector;
7
8
use Fabfuel\Prophiler\DataCollectorInterface;
9
10
class Generic implements DataCollectorInterface
11
{
12
    protected $title = 'Unnamed';
13
    protected $icon;
14
    protected $data = [];
15
16
    /**
17
     * Get the title of this data collector
18
     *
19
     * @return string
20
     */
21 1
    public function getTitle()
22
    {
23 1
        return $this->title;
24
    }
25
26
    /**
27
     * Set title for this data collector
28
     *
29
     * @param string $title
30
     */
31 1
    public function setTitle($title)
32
    {
33 1
        $this->title = (string) $title;
34 1
    }
35
36
    /**
37
     * Get the icon HTML markup
38
     * If icon not set - returns empty string
39
     *
40
     * For example font-awesome icons: <i class="fa fa-pie-chart"></i>
41
     * See: http://fortawesome.github.io/Font-Awesome/icons/
42
     *
43
     * @return string
44
     */
45 2
    public function getIcon()
46
    {
47 2
        return $this->icon ? sprintf('<i class="fa %s"></i>', $this->icon) : '';
48
    }
49
50
    /**
51
     * Set icon for HTML markup
52
     *
53
     * This should be font-awesome icon eg. fa-circle-thin
54
     * See: http://fortawesome.github.io/Font-Awesome/icons/
55
     *
56
     * @param string $icon
57
     */
58 2
    public function setIcon($icon)
59
    {
60 2
        $this->icon = (string) $icon;
61 2
    }
62
63
    /**
64
     * Get data from the data collector
65
     *
66
     * @return array
67
     */
68 1
    public function getData()
69
    {
70 1
        return $this->data;
71
    }
72
73
    /**
74
     * Set data for data collector
75
     *
76
     * @param array $data
77
     */
78 1
    public function setData(array $data)
79
    {
80 1
        $this->data = $data;
81 1
    }
82
}
83