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

CheckResult::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 2
eloc 5
nc 2
nop 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