Monitoring   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 97
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 1 Features 0
Metric Value
wmc 9
c 4
b 1
f 0
lcom 1
cbo 1
dl 0
loc 97
ccs 23
cts 23
cp 1
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setStatus() 0 11 3
A setDownTime() 0 6 1
A setResponseTime() 0 6 1
A getStatus() 0 4 1
A getDownTime() 0 4 1
A getResponseTime() 0 4 1
A getData() 0 8 1
1
<?php
2
3
namespace CarlosIO\Geckoboard\Widgets;
4
5
/**
6
 * Class Monitoring.
7
 */
8
class Monitoring extends Widget
9
{
10
    const STATUS_UP = 'Up';
11
    const STATUS_DOWN = 'Down';
12
13
    /**
14
     * @var string
15
     */
16
    protected $status;
17
18
    /**
19
     * @var string
20
     */
21
    protected $downTime;
22
23
    /**
24
     * @var string
25
     */
26
    protected $responseTime;
27
28
    /**
29
     * @param $status
30
     *
31
     * @return $this
32
     */
33 2
    public function setStatus($status)
34
    {
35 2
        if ($status !== self::STATUS_UP && $status !== self::STATUS_DOWN) {
36 1
            $message = "Value '%s' must be ".self::STATUS_UP.' or '.self::STATUS_DOWN;
37 1
            throw new \InvalidArgumentException(sprintf($message, $status));
38
        }
39
40 1
        $this->status = $status;
41
42 1
        return $this;
43
    }
44
45
    /**
46
     * @param $downtime
47
     *
48
     * @return $this
49
     */
50 1
    public function setDownTime($downtime)
51
    {
52 1
        $this->downTime = $downtime;
53
54 1
        return $this;
55
    }
56
57
    /**
58
     * @param $responseTime
59
     *
60
     * @return $this
61
     */
62 1
    public function setResponseTime($responseTime)
63
    {
64 1
        $this->responseTime = $responseTime;
65
66 1
        return $this;
67
    }
68
69
    /**
70
     * @return string
71
     */
72 1
    public function getStatus()
73
    {
74 1
        return $this->status;
75
    }
76
77
    /**
78
     * @return string
79
     */
80 1
    public function getDownTime()
81
    {
82 1
        return $this->downTime;
83
    }
84
85
    /**
86
     * @return string
87
     */
88 1
    public function getResponseTime()
89
    {
90 1
        return $this->responseTime;
91
    }
92
93
    /**
94
     * @return array
95
     */
96 1
    public function getData()
97
    {
98
        return array(
99 1
            'status' => $this->getStatus(),
100 1
            'downTime' => $this->getDownTime(),
101 1
            'responseTime' => $this->getResponseTime(),
102 1
        );
103
    }
104
}
105