Completed
Push — master ( d6c050...95a747 )
by Nekrasov
02:07
created

CheckResult   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
1
<?php
2
3
namespace Arrilot\SystemCheck;
4
5
use InvalidArgumentException;
6
7
class CheckResult
8
{
9
    /**
10
     * Status message.
11
     *
12
     * @var string
13
     */
14
    public $status;
15
16
    /**
17
     * Result comment.
18
     *
19
     * @var string
20
     */
21
    public $comment;
22
23
    /**
24
     * Possible check statuses.
25
     *
26
     * @var array
27
     */
28
    protected $possibleStatuses = [
29
        'Ok',
30
        'Note',
31
        'Fail',
32
        'Skip',
33
    ];
34
35
    /**
36
     * Result constructor.
37
     *
38
     * @param string $status
39
     * @param string $comment
40
     */
41
    public function __construct($status, $comment)
42
    {
43
        if (! in_array($status, $this->possibleStatuses)) {
44
            throw new InvalidArgumentException("Check result can not have status '{$status}'");
45
        }
46
47
        $this->status = $status;
48
        $this->comment = $comment;
49
    }
50
}
51