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.
Completed
Push — master ( cc194b...accbf4 )
by Daniel
12:20 queued 01:33
created

Handler::downloadHandler()   B

Complexity

Conditions 7
Paths 5

Size

Total Lines 21
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 9.3554

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 7
eloc 11
nc 5
nop 1
dl 0
loc 21
ccs 7
cts 11
cp 0.6364
crap 9.3554
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 1
    public function __construct(Throwable $thrown)
14
    {
15 1
        $this->thrown = $thrown;
16 1
    }
17
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