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.

DERData::typeClass()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Sop\ASN1;
6
7
use Sop\ASN1\Component\Identifier;
8
use Sop\ASN1\Component\Length;
9
10
/**
11
 * Container for raw DER encoded data.
12
 *
13
 * May be inserted into structure without decoding first.
14
 */
15
class DERData extends Element
16
{
17
    /**
18
     * DER encoded data.
19
     *
20
     * @var string
21
     */
22
    protected $_der;
23
24
    /**
25
     * Identifier of the underlying type.
26
     *
27
     * @var Identifier
28
     */
29
    protected $_identifier;
30
31
    /**
32
     * Offset to the content in DER data.
33
     *
34
     * @var int
35
     */
36
    protected $_contentOffset = 0;
37
38
    /**
39
     * Constructor.
40
     *
41
     * @param string $data DER encoded data
42
     *
43
     * @throws \Sop\ASN1\Exception\DecodeException If data does not adhere to DER
44
     */
45 6
    public function __construct(string $data)
46
    {
47 6
        $this->_identifier = Identifier::fromDER($data, $this->_contentOffset);
48
        // check that length encoding is valid
49 6
        Length::expectFromDER($data, $this->_contentOffset);
50 6
        $this->_der = $data;
51 6
        $this->_typeTag = $this->_identifier->intTag();
52 6
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57 2
    public function typeClass(): int
58
    {
59 2
        return $this->_identifier->typeClass();
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65 2
    public function isConstructed(): bool
66
    {
67 2
        return $this->_identifier->isConstructed();
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73 3
    public function toDER(): string
74
    {
75 3
        return $this->_der;
76
    }
77
78
    /**
79
     * {@inheritdoc}
80
     */
81 2
    protected function _encodedContentDER(): string
82
    {
83
        // if there's no content payload
84 2
        if (strlen($this->_der) === $this->_contentOffset) {
85 1
            return '';
86
        }
87 1
        return substr($this->_der, $this->_contentOffset);
88
    }
89
}
90