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 ( 81a457...ca7640 )
by Daniel
03:05
created

CouldNotDownloadCertificate   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 45.45%

Importance

Changes 0
Metric Value
dl 0
loc 47
ccs 10
cts 22
cp 0.4545
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 2

5 Methods

Rating   Name   Duplication   Size   Complexity  
A hostDoesNotExist() 0 7 1
A noCertificateInstalled() 0 7 1
A failedHandshake() 0 10 2
A connectionTimeout() 0 7 1
A unknownError() 0 7 1
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
    public static function hostDoesNotExist(string $hostName): CouldNotDownloadCertificate
13
    {
14
        $exception = new static("The host named `{$hostName}` does not exist.");
15
        $exception->setErrorDomain($hostName);
16
17
        return $exception;
18
    }
19
20
    public static function noCertificateInstalled(string $hostName): CouldNotDownloadCertificate
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): CouldNotDownloadCertificate
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): CouldNotDownloadCertificate
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): CouldNotDownloadCertificate
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