Conditions | 7 |
Paths | 5 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 9.3554 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | 1 | public function downloadHandler(Url $parsedUrl) |
|
19 | { |
||
20 | 1 | $errorMsg = $this->thrown->getMessage(); |
|
21 | 1 | if (str_contains($errorMsg, 'getaddrinfo failed') === true) { |
|
22 | throw CouldNotDownloadCertificate::hostDoesNotExist($parsedUrl->getHostName()); |
||
23 | } |
||
24 | |||
25 | 1 | if (str_contains($errorMsg, 'error:14090086') === true) { |
|
26 | throw CouldNotDownloadCertificate::noCertificateInstalled($parsedUrl->getHostName()); |
||
27 | } |
||
28 | |||
29 | 1 | if (str_contains($errorMsg, 'error:14077410') === true || str_contains($errorMsg, 'error:140770FC') === true || str_contains($errorMsg, 'error:14094410:SSL')) { |
|
30 | throw CouldNotDownloadCertificate::failedHandshake($parsedUrl); |
||
31 | } |
||
32 | |||
33 | 1 | if (str_contains($errorMsg, '(Connection timed out)') === true) { |
|
34 | 1 | throw CouldNotDownloadCertificate::connectionTimeout($parsedUrl->getTestURL()); |
|
35 | } |
||
36 | |||
37 | throw CouldNotDownloadCertificate::unknownError($parsedUrl->getTestURL(), $errorMsg); |
||
38 | } |
||
39 | } |
||
40 |