Status   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 4
c 2
b 1
f 0
lcom 0
cbo 0
dl 0
loc 74
ccs 11
cts 11
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getCode() 0 4 1
A getDescription() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
namespace Actuator\Health;
4
5
/**
6
 * Value object to express state of a component or subsystem.
7
 */
8
class Status
9
{
10
    /**
11
     * Value representing unknown state.
12
     */
13
    const UNKNOWN = 'UNKNOWN';
14
15
    /**
16
     * Value representing up state.
17
     */
18
    const UP = 'UP';
19
20
    /**
21
     * Value representing down state.
22
     */
23
    const DOWN = 'DOWN';
24
25
    /**
26
     * Value representing out-of-service state.
27
     */
28
    const OUT_OF_SERVICE = 'OUT_OF_SERVICE';
29
30
    /**
31
     * @var string
32
     */
33
    private $code;
34
35
    /**
36
     * @var string
37
     */
38
    private $description;
39
40
    /**
41
     * Create a new Status instance with the given code and description.
42
     *
43
     * @param string $code
44
     * @param string $description
45
     */
46
    public function __construct($code, $description = '')
47
    {
48 111
        assert(!is_null($code), 'Code must not be null');
49
50 111
        $this->code = $code;
51
        $this->description = $description;
52 111
    }
53 111
54 111
    /**
55
     * Return the code for this status.
56
     *
57
     * @return string
58
     */
59
    public function getCode()
60
    {
61 42
        return $this->code;
62
    }
63 42
64
    /**
65
     * Return the description of this status.
66
     *
67
     * @return string
68
     */
69
    public function getDescription()
70
    {
71 3
        return $this->description;
72
    }
73 3
74
    /**
75
     * @return string
76
     */
77
    public function __toString()
78
    {
79 57
        return $this->code;
80
    }
81
}
82