| Conditions | 7 |
| Paths | 5 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 7.2944 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | 6 | public function downloadHandler(Url $parsedUrl) |
|
| 19 | { |
||
| 20 | 6 | $errorMsg = $this->thrown->getMessage(); |
|
| 21 | 6 | if (str_contains($errorMsg, 'getaddrinfo failed') === true) { |
|
| 22 | 1 | throw CouldNotDownloadCertificate::hostDoesNotExist($parsedUrl->getHostName()); |
|
| 23 | } |
||
| 24 | |||
| 25 | 5 | if (str_contains($errorMsg, 'error:14090086') === true) { |
|
| 26 | throw CouldNotDownloadCertificate::noCertificateInstalled($parsedUrl->getHostName()); |
||
| 27 | } |
||
| 28 | |||
| 29 | 5 | if (str_contains($errorMsg, 'error:14077410') === true || str_contains($errorMsg, 'error:140770FC') === true || str_contains($errorMsg, 'error:14094410:SSL')) { |
|
| 30 | 4 | 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 |