Test Failed
Push — master ( a24517...57a539 )
by Fabian
02:46
created

ChallengeError::hasStatusServerError()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace LE_ACME2\Response\Authorization\Struct;
4
5
class ChallengeError implements ChallengeErrorConstructorInterface {
6
7
    const TYPE_ERROR_DNS = 'urn:ietf:params:acme:error:dns';
8
9
    /** @var string $type */
10
    public $type;
11
12
    /** @var string $detail */
13
    public $detail;
14
15
    /** @var int $status */
16
    public $status;
17
18
    public function __construct(string $type, string $detail, int $status) {
19
20
        $this->type = $type;
21
        $this->detail = $detail;
22
        $this->status = $status;
23
    }
24
25
    public static function createFrom(array $array) : static {
26
        return new static(
27
            $array['type'],
28
            $array['detail'],
29
            $array['status'],
30
        );
31
    }
32
33
    public function hasStatusServerError() : bool {
34
        return
35
            $this->status >= 500
36
            && $this->status < 600
37
        ;
38
    }
39
}