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

SslRevocationList   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 57
ccs 0
cts 22
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createFromUrl() 0 13 1
A __construct() 0 11 1
A getRevokedList() 0 4 1
1
<?php
2
3
namespace LiquidWeb\SslCertificate;
4
5
use Carbon\Carbon;
6
7
class SslRevocationList
8
{
9
    /** @var Carbon */
10
    protected $timestamp;
11
12
    /** @var IssuerMeta */
13
    protected $issuer;
14
15
    /** @var Carbon */
16
    protected $createdAt;
17
18
    /** @var Carbon */
19
    protected $expiration;
20
21
    /** @var int */
22
    protected $ttl;
23
24
    /** @var string */
25
    protected $signature;
26
27
    /** @var array */
28
    protected $signatureAlgorithm = [];
29
30
    /** @var array */
31
    protected $revokedCertsList = [];
32
33
    public static function createFromUrl(string $url): self
34
    {
35
        $downloadResults = Downloader::downloadRevocationListFromUrl($url);
36
        $tbsCertList = $downloadResults['tbsCertList'];
37
        $issuer = IssuerMeta::fromRdnSequence($tbsCertList['issuer']['rdnSequence']);
38
        $createdAt = $tbsCertList['thisUpdate']['utcTime'];
39
        $expiration = $tbsCertList['nextUpdate']['utcTime'];
40
        $signature = $downloadResults['signature'];
41
        $signatureAlgorithm = $downloadResults['signatureAlgorithm'];
42
        $certsList = $tbsCertList['revokedCertificates'];
43
44
        return new static($issuer, $createdAt, $expiration, $signature, $signatureAlgorithm, $certsList);
45
    }
46
47
    public function __construct(IssuerMeta $issuer = null, string $createdAt = '', string $expiration = '', string $signature = '', array $signatureAlgorithm = [], array $certsList = [])
48
    {
49
        $this->timestamp = Carbon::now();
50
        $this->issuer = $issuer;
51
        $this->createdAt = Carbon::parse($createdAt)->setTimezone('UTC');
52
        $this->expiration = Carbon::parse($expiration)->setTimezone('UTC');
53
        $this->ttl = Carbon::parse($expiration)->diffInMinutes(Carbon::now());
54
        $this->signature = $signature;
55
        $this->signatureAlgorithm = $signatureAlgorithm;
56
        $this->revokedCertsList = $certsList;
57
    }
58
59
    public function getRevokedList(): array
60
    {
61
        return $this->revokedCertsList;
62
    }
63
}
64