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.

NullType::__construct()   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\Type\Primitive;
6
7
use Sop\ASN1\Component\Identifier;
8
use Sop\ASN1\Component\Length;
9
use Sop\ASN1\Element;
10
use Sop\ASN1\Exception\DecodeException;
11
use Sop\ASN1\Feature\ElementBase;
12
use Sop\ASN1\Type\PrimitiveType;
13
use Sop\ASN1\Type\UniversalClass;
14
15
/**
16
 * Implements *NULL* type.
17
 */
18
class NullType extends Element
19
{
20
    use UniversalClass;
21
    use PrimitiveType;
22
23
    /**
24
     * Constructor.
25
     */
26 112
    public function __construct()
27
    {
28 112
        $this->_typeTag = self::TYPE_NULL;
29 112
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 19
    protected function _encodedContentDER(): string
35
    {
36 19
        return '';
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42 29
    protected static function _decodeFromDER(Identifier $identifier,
43
        string $data, int &$offset): ElementBase
44
    {
45 29
        $idx = $offset;
46 29
        if (!$identifier->isPrimitive()) {
47 1
            throw new DecodeException('Null value must be primitive.');
48
        }
49
        // null type has always zero length
50 28
        Length::expectFromDER($data, $idx, 0);
51 27
        $offset = $idx;
52 27
        return new self();
53
    }
54
}
55