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 ( d47af2...5210f7 )
by Nick
02:55
created

Certificate   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 77.78%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 6
c 2
b 0
f 2
lcom 1
cbo 0
dl 0
loc 60
ccs 14
cts 18
cp 0.7778
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A validFrom() 0 6 1
A validTo() 0 6 1
A certName() 0 4 1
A toString() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
namespace Punkstar\Ssl;
4
5
use DateTime;
6
7
class Certificate
8
{
9
    protected $rawCert;
10
    protected $certData;
11
12
    /**
13
     * Certificate constructor.
14
     *
15
     * @param string $certificate
16
     */
17 3
    public function __construct($certificate)
18
    {
19 3
        $this->rawCert = $certificate;
20 3
        $this->certData = openssl_x509_parse($this->rawCert);
21 3
    }
22
23
    /**
24
     * @return DateTime
25
     */
26 3
    public function validFrom()
27
    {
28 3
        $date = new DateTime();
29 3
        $date->setTimestamp($this->certData['validFrom_time_t']);
30 3
        return $date;
31
    }
32
33
    /**
34
     * @return DateTime
35
     */
36 3
    public function validTo()
37
    {
38 3
        $date = new DateTime();
39 3
        $date->setTimestamp($this->certData['validTo_time_t']);
40 3
        return $date;
41
    }
42
43
    /**
44
     * @return string
45
     */
46 3
    public function certName()
47
    {
48 3
        return $this->certData['name'];
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function toString()
55
    {
56
        return $this->rawCert;
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function __toString()
63
    {
64
        return $this->toString();
65
    }
66
}
67