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 — php72 ( 2f43a1...f5fc00 )
by Joni
03:42
created

ConstructedString   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 50
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A _decodeFromDER() 0 8 1
A __construct() 0 3 1
A create() 0 5 1
A strings() 0 5 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Sop\ASN1\Type\Constructed;
6
7
use Sop\ASN1\Component\Identifier;
8
use Sop\ASN1\Element;
9
use Sop\ASN1\Feature\ElementBase;
10
use Sop\ASN1\Type\PrimitiveString;
11
use Sop\ASN1\Type\Structure;
12
13
/**
14
 * Implements constructed type of simple strings.
15
 */
16
class ConstructedString extends Structure
17
{
18
    /**
19
     * Constructor.
20
     *
21
     * @param Element ...$elements Any number of elements
22
     */
23 2
    protected function __construct(Element ...$elements)
24
    {
25 2
        parent::__construct(...$elements);
26 2
    }
27
28
    /**
29
     * Create constructed string.
30
     *
31
     * @param int             $tag         Type tag
32
     * @param PrimitiveString ...$elements Any number of elements
33
     */
34 1
    public static function create(int $tag, PrimitiveString ...$elements)
35
    {
36 1
        $el = new self(...$elements);
37 1
        $el->_typeTag = $tag;
38 1
        return $el;
39
    }
40
41
    /**
42
     * Get a list of strings in this structure.
43
     *
44
     * @return string[]
45
     */
46 1
    public function strings(): array
47
    {
48
        return array_map(function (PrimitiveString $el) {
49 1
            return $el->string();
50 1
        }, $this->_elements);
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     *
56
     * @return self
57
     */
58 1
    protected static function _decodeFromDER(Identifier $identifier,
59
        string $data, int &$offset): ElementBase
60
    {
61
        /** @var ConstructedString $type */
62 1
        $type = forward_static_call_array([parent::class, __FUNCTION__],
63 1
            [$identifier, $data, &$offset]);
64 1
        $type->_typeTag = $identifier->intTag();
65 1
        return $type;
66
    }
67
}
68