Completed
Push — master ( d161df...14a64f )
by Tim
02:10
created

TestResult::getState()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 9.4285
1
<?php
2
3
namespace SimpleSAML\Module\monitor;
4
5
final class TestResult
6
{
7
    /**
8
     * @var string  Test category this test belongs to
9
     */
10
    private $category;
11
12
    /**
13
     * @var string  The subject that was tested
14
     */
15
    private $subject;
16
17
    /**
18
     * @var string  Message describing the result
19
     */
20
    private $message;
21
22
    /**
23
     * @var array   Data to be used by TestSuite or other TestCases
24
     */
25
    private $output;
26
27
    /**
28
     * @var State   The State object reflecting the result
29
     */
30
    private $state = State::NOSTATE;
31
32
    /**
33
     * @param string $category
34
     * @param string $subject
35
     */
36
    public function __construct($category = 'Unknown category', $subject = 'Unknown subject')
37
    {
38
        $this->category = $category;
39
        $this->subject = $subject;
40
        $this->output = array();
41
    }
42
43
    /**
44
     * @param State $state
45
     *
46
     * @return void
47
     */
48
    public function setState($state = State::NOSTATE)
49
    {
50
        assert($state instanceof State);
51
        $this->state = $state;
52
    }
53
54
    /**
55
     * @return State
56
     */
57
    public function getState()
58
    {
59
        assert($this->state instanceof State);
60
        return $this->state;
61
    }
62
63
    /**
64
     * @param string $message
65
     *
66
     * @return void
67
     */
68
    public function setMessage($message)
69
    {
70
        assert(is_string($message));
71
        $this->message = $message;
72
    }
73
74
75
    /**
76
     * @return string
77
     */
78
    public function getMessage()
79
    {
80
        assert(is_string($this->message));
81
        return $this->message;
82
    }
83
84
    /**
85
     * @param array $value
86
     *
87
     * @return void
88
     */
89
    public function setOutput($value)
90
    {
91
        assert(is_array($value));
92
        $this->output = $value;
93
    }
94
95
    /**
96
     * @return array
97
     */
98
    public function getOutput()
99
    {
100
        assert(is_array($this->output));
101
        return $this->output;
102
    }
103
}
104