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 ( 67970b...cc194b )
by Daniel
05:04
created

CouldNotDownloadCertificate::connectionTimeout()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace LiquidWeb\SslCertificate\Exceptions;
4
5
use Exception;
6
use LiquidWeb\SslCertificate\Url;
7
8
class CouldNotDownloadCertificate extends Exception
9
{
10
    use TrackDomainTrait;
11
12 1
    public static function hostDoesNotExist(string $hostName): self
13
    {
14 1
        $exception = new static("The host named `{$hostName}` does not exist.");
15 1
        $exception->setErrorDomain($hostName);
16
17 1
        return $exception;
18
    }
19
20
    public static function noCertificateInstalled(string $hostName): self
21
    {
22
        $exception = new static("Could not find a certificate on  host named `{$hostName}`.");
23
        $exception->setErrorDomain($hostName);
24
25
        return $exception;
26
    }
27
28 4
    public static function failedHandshake(Url $url): self
29
    {
30 4
        if ($url->getPort() === '80') {
31 1
            return new static('Server does not support SSL over port 80.');
32
        }
33 3
        $exception = new static("Server SSL handshake error – the certificate for `{$url->getTestURL()}` will not work.");
34 3
        $exception->setErrorDomain($url->getHostName());
35
36 3
        return $exception;
37
    }
38
39 1
    public static function connectionTimeout(string $hostName): self
40
    {
41 1
        $exception = new static("Connection timed out while testing `{$hostName}`.");
42 1
        $exception->setErrorDomain($hostName);
43
44 1
        return $exception;
45
    }
46
47
    public static function unknownError(string $hostName, string $errorMessage): self
48
    {
49
        $exception = new static("Could not download certificate for host `{$hostName}` because {$errorMessage}");
50
        $exception->setErrorDomain($hostName);
51
52
        return $exception;
53
    }
54
}
55