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

ChallengeError   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
eloc 15
dl 0
loc 32
ccs 0
cts 4
cp 0
rs 10
c 2
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A createFrom() 0 5 1
A hasStatusServerError() 0 4 2
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
}