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.
Test Failed
Push — master ( 405cf3...79c9ba )
by Joni
04:48
created

SubjectInformationAccessExtension::getIterator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 1
cts 1
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Sop\X509\Certificate\Extension;
6
7
use Sop\ASN1\Element;
8
use Sop\ASN1\Type\Constructed\Sequence;
9
use Sop\ASN1\Type\UnspecifiedType;
10
use Sop\X509\Certificate\Extension\AccessDescription\AccessDescription;
11
use Sop\X509\Certificate\Extension\AccessDescription\SubjectAccessDescription;
12
13
/**
14
 * Implements 'Subject Information Access' extension.
15
 *
16
 * @see https://tools.ietf.org/html/rfc5280#section-4.2.2.2
17
 */
18
class SubjectInformationAccessExtension extends Extension implements \Countable, \IteratorAggregate
19
{
20
    /**
21
     * Access descriptions.
22
     *
23
     * @var SubjectAccessDescription[]
24
     */
25
    private $_accessDescriptions;
26
27
    /**
28
     * Constructor.
29
     *
30
     * @param bool                     $critical
31
     * @param SubjectAccessDescription ...$access
32
     */
33 2
    public function __construct(bool $critical, SubjectAccessDescription ...$access)
34
    {
35
        parent::__construct(self::OID_SUBJECT_INFORMATION_ACCESS, $critical);
36 2
        $this->_accessDescriptions = $access;
37 2
    }
38 2
39
    /**
40
     * Get the access descriptions.
41
     *
42
     * @return SubjectAccessDescription[]
43
     */
44
    public function accessDescriptions(): array
45 1
    {
46
        return $this->_accessDescriptions;
47 1
    }
48 1
49 1
    /**
50 1
     * Get the number of access descriptions.
51 1
     *
52
     * @see \Countable::count()
53
     *
54
     * @return int
55
     */
56
    public function count(): int
57
    {
58
        return count($this->_accessDescriptions);
59 1
    }
60
61 1
    /**
62
     * Get iterator for access descriptions.
63
     *
64
     * @see \IteratorAggregate::getIterator()
65
     *
66
     * @return \ArrayIterator List of SubjectAccessDescription objects
67
     */
68
    public function getIterator(): \ArrayIterator
69 1
    {
70
        return new \ArrayIterator($this->_accessDescriptions);
71 1
    }
72 1
73 1
    /**
74 1
     * {@inheritdoc}
75 1
     */
76
    protected static function _fromDER(string $data, bool $critical): Extension
77
    {
78
        $access = array_map(
79
            function (UnspecifiedType $el) {
80
                return SubjectAccessDescription::fromASN1($el->asSequence());
81
            }, UnspecifiedType::fromDER($data)->asSequence()->elements());
82
        return new self($critical, ...$access);
83
    }
84 1
85
    /**
86 1
     * {@inheritdoc}
87
     */
88
    protected function _valueASN1(): Element
89
    {
90
        $elements = array_map(
91
            function (AccessDescription $access) {
92
                return $access->toASN1();
93
            }, $this->_accessDescriptions);
94
        return new Sequence(...$elements);
95 1
    }
96
}
97