Health   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 10
c 1
b 0
f 0
dl 0
loc 72
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setState() 0 3 1
A isOk() 0 3 2
A getState() 0 3 1
A getChecks() 0 3 1
A setCheck() 0 3 1
A __construct() 0 4 1
1
<?php
2
namespace Health;
3
4
class Health
5
{
6
7
    /**
8
     * State
9
     *
10
     * @var string
11
     */
12
    private $state = '';
13
14
    /**
15
     * Helath Checks
16
     *
17
     * @var array
18
     */
19
    private $checks = [];
20
21
    /**
22
     * Health constructor.
23
     *
24
     * @param string $state
25
     * @param array $checks
26
     */
27
    public function __construct($state = HealthCheck::STATE_UP, $checks = [])
28
    {
29
        $this->state = $state;
30
        $this->checks = $checks;
31
    }
32
33
    /**
34
     *
35
     * @return boolean
36
     */
37
    public function isOk()
38
    {
39
        return $this->state === HealthCheck::STATE_UP ? true : false;
40
    }
41
42
    /**
43
     *
44
     * @return string
45
     */
46
    public function getState()
47
    {
48
        return $this->state;
49
    }
50
51
    /**
52
     *
53
     * @param string $state
54
     */
55
    public function setState($state)
56
    {
57
        $this->state = $state;
58
    }
59
60
    /**
61
     *
62
     * @return array
63
     */
64
    public function getChecks()
65
    {
66
        return $this->checks;
67
    }
68
69
    /**
70
     *
71
     * @param mixed $check
72
     */
73
    public function setCheck($check)
74
    {
75
        $this->checks[] = $check;
76
    }
77
}
78