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 ( d5b2cb...96add5 )
by Nick
03:44 queued 01:22
created

Certificate::validTo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 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 7
    public function __construct($certificate)
18
    {
19 7
        $this->rawCert = $certificate;
20 7
        $this->certData = openssl_x509_parse($this->rawCert);
21 7
    }
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 6
    public function toString()
55
    {
56 6
        return $this->rawCert;
57
    }
58
59
    /**
60
     * @return string
61
     */
62 6
    public function __toString()
63
    {
64 6
        return $this->toString();
65
    }
66
}
67