Completed
Push — master ( 7519fb...48b4f6 )
by Tim
01:31
created

TestResult   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 73
rs 10
c 0
b 0
f 0
wmc 5
lcom 2
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setState() 0 5 1
A getState() 0 5 1
A __construct() 0 5 1
A setMessage() 0 5 1
A getMessage() 0 5 1
1
<?php
2
3
namespace SimpleSAML\Module\monitor;
4
5
final class TestResult
6
{
7
    /**
8
     * @var string
9
     */
10
    private $category;
11
12
    /**
13
     * @var string
14
     */
15
    private $subject;
16
17
    /**
18
     * @var string
19
     */
20
    private $message;
21
22
    /**
23
     * @var State
24
     */
25
    private $state = State::NOSTATE;
26
27
    /**
28
     * @param string $category
29
     * @param string $subject
30
     */
31
    public function __construct($category = 'Unknown category', $subject = 'Unknown subject')
32
    {
33
        $this->category = $category;
34
        $this->subject = $subject;
35
    }
36
37
    /**
38
     * @param State $state
39
     *
40
     * @return void
41
     */
42
    public function setState($state = State::NOSTATE)
43
    {
44
        assert($state instanceof State);
45
        $this->state = $state;
46
    }
47
48
    /**
49
     * @return State
50
     */
51
    public function getState()
52
    {
53
        assert($this->state instanceof State);
54
        return $this->state;
55
    }
56
57
    /**
58
     * @param string $message
59
     *
60
     * @return void
61
     */
62
    public function setMessage($message)
63
    {
64
        assert(is_string($message));
65
        $this->message = $message;
66
    }
67
68
69
    /**
70
     * @return string
71
     */
72
    public function getMessage()
73
    {
74
        assert(is_string($this->message));
75
        return $this->message;
76
    }
77
}
78