Conditions | 5 |
Paths | 4 |
Total Lines | 29 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | public function getChallenge(string $type) : ?Struct\Challenge { |
||
30 | |||
31 | foreach($this->getChallenges() as $challenge) { |
||
32 | |||
33 | if($type == $challenge['type']) { |
||
34 | |||
35 | $error = null; |
||
36 | if(isset($challenge[ 'error' ]) && $challenge[ 'error' ] != "") { |
||
37 | $error = new Struct\ChallengeError( |
||
38 | $challenge[ 'error' ][ 'type' ], |
||
39 | $challenge[ 'error' ][ 'detail' ], |
||
40 | $challenge[ 'error' ][ 'status' ], |
||
41 | ); |
||
42 | } |
||
43 | |||
44 | return new Struct\Challenge( |
||
45 | $challenge[ 'type' ], |
||
46 | $challenge[ 'status' ], |
||
47 | $challenge[ 'url' ], |
||
48 | $challenge[ 'token' ], |
||
49 | $error, |
||
50 | ); |
||
51 | } |
||
52 | } |
||
53 | |||
54 | // There is not a challenge for a specific type, when the subject is already authorized by another |
||
55 | // authorize type, f.e. when switching from http-01 to dns-01 |
||
56 | |||
57 | return null; |
||
58 | } |
||
59 | } |