Completed
Push — master ( 1d81aa...c97ce5 )
by Tim
01:33
created

TestResult   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 52
rs 10
wmc 3
lcom 1
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setState() 0 5 1
A getState() 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;
0 ignored issues
show
Unused Code introduced by
The property $message is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
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;
0 ignored issues
show
Bug introduced by
The variable $state does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
55
    }
56
}
57