GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Handler::downloadHandler()   B
last analyzed

Complexity

Conditions 7
Paths 5

Size

Total Lines 21
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 7.2944

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 7
eloc 11
nc 5
nop 1
dl 0
loc 21
ccs 9
cts 11
cp 0.8182
crap 7.2944
rs 7.551
c 2
b 0
f 0
1
<?php
2
3
namespace LiquidWeb\SslCertificate\Exceptions;
4
5
use Throwable;
6
use LiquidWeb\SslCertificate\Url;
7
use function LiquidWeb\SslCertificate\str_contains as str_contains;
8
9
class Handler
10
{
11
    protected $thrown;
12
13 6
    public function __construct(Throwable $thrown)
14
    {
15 6
        $this->thrown = $thrown;
16 6
    }
17
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