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
Branch php72 (a7f01e)
by Joni
04:53
created

AccessDescription::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Sop\X509\Certificate\Extension\AccessDescription;
6
7
use Sop\ASN1\Type\Constructed\Sequence;
8
use Sop\ASN1\Type\Primitive\ObjectIdentifier;
9
use Sop\X509\GeneralName\GeneralName;
10
11
/**
12
 * Base class implementing <i>AccessDescription</i> ASN.1 type for
13
 * 'Authority Information Access' and 'Subject Information Access' certificate
14
 * extensions.
15
 *
16
 * @see https://tools.ietf.org/html/rfc5280#section-4.2.2.1
17
 */
18
abstract class AccessDescription
19
{
20
    /**
21
     * Access method OID.
22
     *
23
     * @var string
24
     */
25
    protected $_accessMethod;
26
27
    /**
28
     * Access location.
29
     *
30
     * @var GeneralName
31
     */
32
    protected $_accessLocation;
33
34
    /**
35
     * Constructor.
36
     *
37
     * @param string      $method   Access method OID
38
     * @param GeneralName $location Access location
39
     */
40 16
    public function __construct(string $method, GeneralName $location)
41
    {
42 16
        $this->_accessMethod = $method;
43 16
        $this->_accessLocation = $location;
44 16
    }
45
46
    /**
47
     * Initialize from ASN.1.
48
     *
49
     * @param Sequence $seq
50
     *
51
     * @return self
52
     */
53 12
    public static function fromASN1(Sequence $seq): self
54
    {
55 12
        return new static($seq->at(0)->asObjectIdentifier()->oid(),
56 12
            GeneralName::fromASN1($seq->at(1)->asTagged()));
57
    }
58
59
    /**
60
     * Get the access method OID.
61
     *
62
     * @return string
63
     */
64 2
    public function accessMethod(): string
65
    {
66 2
        return $this->_accessMethod;
67
    }
68
69
    /**
70
     * Get the access location.
71
     *
72
     * @return GeneralName
73
     */
74 2
    public function accessLocation(): GeneralName
75
    {
76 2
        return $this->_accessLocation;
77
    }
78
79
    /**
80
     * Generate ASN.1 structure.
81
     *
82
     * @return Sequence
83
     */
84 18
    public function toASN1(): Sequence
85
    {
86 18
        return new Sequence(new ObjectIdentifier($this->_accessMethod),
87 18
            $this->_accessLocation->toASN1());
88
    }
89
}
90