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 ( acc841...466809 )
by Daniel
12:49 queued 11:40
created

Handler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 1
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