| Conditions | 3 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 10 | public static function http(string $domain, string $token, string $keyAuthorization): void |
||
| 11 | { |
||
| 12 | $httpClient = new Client(10, 1); |
||
| 13 | |||
| 14 | $response = $httpClient->get($domain . '/.well-known/acme-challenge/' . $token); |
||
| 15 | |||
| 16 | $body = $response->getBody(); |
||
| 17 | |||
| 18 | if (is_array($body)) { |
||
| 19 | $body = json_encode($body); |
||
| 20 | } |
||
| 21 | |||
| 22 | if (trim($body) === $keyAuthorization) { |
||
| 23 | return; |
||
| 24 | } |
||
| 25 | |||
| 26 | throw DomainValidationException::localHttpChallengeTestFailed( |
||
| 27 | $domain, |
||
| 28 | $response->getHttpResponseCode() ?? 'unknown' |
||
| 29 | ); |
||
| 43 |