Health::setCheck()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 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