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 ( 57c34e...46de60 )
by Joni
02:02
created
lib/ASN1/Type/Primitive/Enumerated.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
7 7
  */
8 8
 class Enumerated extends Integer
9 9
 {
10
-    /**
11
-     * Constructor.
12
-     *
13
-     * @param int|string $number
14
-     */
15
-    public function __construct($number)
16
-    {
17
-        parent::__construct($number);
18
-        $this->_typeTag = self::TYPE_ENUMERATED;
19
-    }
10
+	/**
11
+	 * Constructor.
12
+	 *
13
+	 * @param int|string $number
14
+	 */
15
+	public function __construct($number)
16
+	{
17
+		parent::__construct($number);
18
+		$this->_typeTag = self::TYPE_ENUMERATED;
19
+	}
20 20
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\ASN1\Type\Primitive;
6 6
 
Please login to merge, or discard this patch.
lib/ASN1/Feature/Encodable.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@
 block discarded – undo
9 9
  */
10 10
 interface Encodable
11 11
 {
12
-    /**
13
-     * Encode object to DER.
14
-     *
15
-     * @return string
16
-     */
17
-    public function toDER(): string;
12
+	/**
13
+	 * Encode object to DER.
14
+	 *
15
+	 * @return string
16
+	 */
17
+	public function toDER(): string;
18 18
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\ASN1\Feature;
6 6
 
Please login to merge, or discard this patch.
lib/ASN1/Type/Primitive/OctetString.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -12,16 +12,16 @@
 block discarded – undo
12 12
  */
13 13
 class OctetString extends PrimitiveString
14 14
 {
15
-    use UniversalClass;
15
+	use UniversalClass;
16 16
     
17
-    /**
18
-     * Constructor.
19
-     *
20
-     * @param string $string
21
-     */
22
-    public function __construct(string $string)
23
-    {
24
-        $this->_typeTag = self::TYPE_OCTET_STRING;
25
-        parent::__construct($string);
26
-    }
17
+	/**
18
+	 * Constructor.
19
+	 *
20
+	 * @param string $string
21
+	 */
22
+	public function __construct(string $string)
23
+	{
24
+		$this->_typeTag = self::TYPE_OCTET_STRING;
25
+		parent::__construct($string);
26
+	}
27 27
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\ASN1\Type\Primitive;
6 6
 
Please login to merge, or discard this patch.
lib/ASN1/Type/Primitive/CharacterString.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@
 block discarded – undo
9 9
 
10 10
 class CharacterString extends PrimitiveString
11 11
 {
12
-    use UniversalClass;
12
+	use UniversalClass;
13 13
     
14
-    /**
15
-     * Constructor.
16
-     *
17
-     * @param string $string
18
-     */
19
-    public function __construct(string $string)
20
-    {
21
-        $this->_typeTag = self::TYPE_CHARACTER_STRING;
22
-        parent::__construct($string);
23
-    }
14
+	/**
15
+	 * Constructor.
16
+	 *
17
+	 * @param string $string
18
+	 */
19
+	public function __construct(string $string)
20
+	{
21
+		$this->_typeTag = self::TYPE_CHARACTER_STRING;
22
+		parent::__construct($string);
23
+	}
24 24
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\ASN1\Type\Primitive;
6 6
 
Please login to merge, or discard this patch.
lib/ASN1/Type/Primitive/ObjectDescriptor.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -12,26 +12,26 @@
 block discarded – undo
12 12
  */
13 13
 class ObjectDescriptor extends PrimitiveString
14 14
 {
15
-    use UniversalClass;
15
+	use UniversalClass;
16 16
     
17
-    /**
18
-     * Constructor.
19
-     *
20
-     * @param string $descriptor
21
-     */
22
-    public function __construct(string $descriptor)
23
-    {
24
-        $this->_string = $descriptor;
25
-        $this->_typeTag = self::TYPE_OBJECT_DESCRIPTOR;
26
-    }
17
+	/**
18
+	 * Constructor.
19
+	 *
20
+	 * @param string $descriptor
21
+	 */
22
+	public function __construct(string $descriptor)
23
+	{
24
+		$this->_string = $descriptor;
25
+		$this->_typeTag = self::TYPE_OBJECT_DESCRIPTOR;
26
+	}
27 27
     
28
-    /**
29
-     * Get the object descriptor.
30
-     *
31
-     * @return string
32
-     */
33
-    public function descriptor(): string
34
-    {
35
-        return $this->_string;
36
-    }
28
+	/**
29
+	 * Get the object descriptor.
30
+	 *
31
+	 * @return string
32
+	 */
33
+	public function descriptor(): string
34
+	{
35
+		return $this->_string;
36
+	}
37 37
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\ASN1\Type\Primitive;
6 6
 
Please login to merge, or discard this patch.
lib/ASN1/Type/Primitive/Integer.php 3 patches
Switch Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -71,11 +71,11 @@
 block discarded – undo
71 71
         $num = $this->_number->gmpObj();
72 72
         switch (gmp_sign($num)) {
73 73
             // positive
74
-            case 1:
75
-                return self::_encodePositiveInteger($num);
76
-            // negative
77
-            case -1:
78
-                return self::_encodeNegativeInteger($num);
74
+        case 1:
75
+            return self::_encodePositiveInteger($num);
76
+        // negative
77
+        case -1:
78
+            return self::_encodeNegativeInteger($num);
79 79
         }
80 80
         // zero
81 81
         return "\0";
Please login to merge, or discard this patch.
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -17,161 +17,161 @@
 block discarded – undo
17 17
  */
18 18
 class Integer extends Element
19 19
 {
20
-    use UniversalClass;
21
-    use PrimitiveType;
20
+	use UniversalClass;
21
+	use PrimitiveType;
22 22
 
23
-    /**
24
-     * The number.
25
-     *
26
-     * @var BigInt
27
-     */
28
-    private $_number;
23
+	/**
24
+	 * The number.
25
+	 *
26
+	 * @var BigInt
27
+	 */
28
+	private $_number;
29 29
 
30
-    /**
31
-     * Constructor.
32
-     *
33
-     * @param int|string $number Base 10 integer
34
-     */
35
-    public function __construct($number)
36
-    {
37
-        $this->_typeTag = self::TYPE_INTEGER;
38
-        if (!self::_validateNumber($number)) {
39
-            $var = is_scalar($number) ? strval($number) : gettype($number);
40
-            throw new \InvalidArgumentException("'${var}' is not a valid number.");
41
-        }
42
-        $this->_number = new BigInt($number);
43
-    }
30
+	/**
31
+	 * Constructor.
32
+	 *
33
+	 * @param int|string $number Base 10 integer
34
+	 */
35
+	public function __construct($number)
36
+	{
37
+		$this->_typeTag = self::TYPE_INTEGER;
38
+		if (!self::_validateNumber($number)) {
39
+			$var = is_scalar($number) ? strval($number) : gettype($number);
40
+			throw new \InvalidArgumentException("'${var}' is not a valid number.");
41
+		}
42
+		$this->_number = new BigInt($number);
43
+	}
44 44
 
45
-    /**
46
-     * Get the number as a base 10.
47
-     *
48
-     * @return string Integer as a string
49
-     */
50
-    public function number(): string
51
-    {
52
-        return $this->_number->base10();
53
-    }
45
+	/**
46
+	 * Get the number as a base 10.
47
+	 *
48
+	 * @return string Integer as a string
49
+	 */
50
+	public function number(): string
51
+	{
52
+		return $this->_number->base10();
53
+	}
54 54
 
55
-    /**
56
-     * Get the number as an integer type.
57
-     *
58
-     * @return int
59
-     */
60
-    public function intNumber(): int
61
-    {
62
-        return $this->_number->intVal();
63
-    }
55
+	/**
56
+	 * Get the number as an integer type.
57
+	 *
58
+	 * @return int
59
+	 */
60
+	public function intNumber(): int
61
+	{
62
+		return $this->_number->intVal();
63
+	}
64 64
 
65
-    /**
66
-     * {@inheritdoc}
67
-     */
68
-    protected function _encodedContentDER(): string
69
-    {
70
-        $num = $this->_number->gmpObj();
71
-        switch (gmp_sign($num)) {
72
-            // positive
73
-            case 1:
74
-                return self::_encodePositiveInteger($num);
75
-            // negative
76
-            case -1:
77
-                return self::_encodeNegativeInteger($num);
78
-        }
79
-        // zero
80
-        return "\0";
81
-    }
65
+	/**
66
+	 * {@inheritdoc}
67
+	 */
68
+	protected function _encodedContentDER(): string
69
+	{
70
+		$num = $this->_number->gmpObj();
71
+		switch (gmp_sign($num)) {
72
+			// positive
73
+			case 1:
74
+				return self::_encodePositiveInteger($num);
75
+			// negative
76
+			case -1:
77
+				return self::_encodeNegativeInteger($num);
78
+		}
79
+		// zero
80
+		return "\0";
81
+	}
82 82
 
83
-    /**
84
-     * {@inheritdoc}
85
-     */
86
-    protected static function _decodeFromDER(Identifier $identifier,
87
-        string $data, int &$offset): ElementBase
88
-    {
89
-        $idx = $offset;
90
-        $length = Length::expectFromDER($data, $idx)->intLength();
91
-        $bytes = substr($data, $idx, $length);
92
-        $idx += $length;
93
-        $neg = ord($bytes[0]) & 0x80;
94
-        // negative, apply inversion of two's complement
95
-        if ($neg) {
96
-            $len = strlen($bytes);
97
-            for ($i = 0; $i < $len; ++$i) {
98
-                $bytes[$i] = ~$bytes[$i];
99
-            }
100
-        }
101
-        $num = gmp_init(bin2hex($bytes), 16);
102
-        // negative, apply addition of two's complement
103
-        // and produce negative result
104
-        if ($neg) {
105
-            $num = gmp_neg($num + 1);
106
-        }
107
-        $offset = $idx;
108
-        // late static binding since enumerated extends integer type
109
-        return new static(gmp_strval($num, 10));
110
-    }
83
+	/**
84
+	 * {@inheritdoc}
85
+	 */
86
+	protected static function _decodeFromDER(Identifier $identifier,
87
+		string $data, int &$offset): ElementBase
88
+	{
89
+		$idx = $offset;
90
+		$length = Length::expectFromDER($data, $idx)->intLength();
91
+		$bytes = substr($data, $idx, $length);
92
+		$idx += $length;
93
+		$neg = ord($bytes[0]) & 0x80;
94
+		// negative, apply inversion of two's complement
95
+		if ($neg) {
96
+			$len = strlen($bytes);
97
+			for ($i = 0; $i < $len; ++$i) {
98
+				$bytes[$i] = ~$bytes[$i];
99
+			}
100
+		}
101
+		$num = gmp_init(bin2hex($bytes), 16);
102
+		// negative, apply addition of two's complement
103
+		// and produce negative result
104
+		if ($neg) {
105
+			$num = gmp_neg($num + 1);
106
+		}
107
+		$offset = $idx;
108
+		// late static binding since enumerated extends integer type
109
+		return new static(gmp_strval($num, 10));
110
+	}
111 111
 
112
-    /**
113
-     * Encode positive integer to DER content.
114
-     *
115
-     * @param \GMP $num
116
-     *
117
-     * @return string
118
-     */
119
-    private static function _encodePositiveInteger(\GMP $num): string
120
-    {
121
-        $bin = gmp_export($num, 1, GMP_MSW_FIRST | GMP_BIG_ENDIAN);
122
-        // if first bit is 1, prepend full zero byte
123
-        // to represent positive two's complement
124
-        if (ord($bin[0]) & 0x80) {
125
-            $bin = chr(0x00) . $bin;
126
-        }
127
-        return $bin;
128
-    }
112
+	/**
113
+	 * Encode positive integer to DER content.
114
+	 *
115
+	 * @param \GMP $num
116
+	 *
117
+	 * @return string
118
+	 */
119
+	private static function _encodePositiveInteger(\GMP $num): string
120
+	{
121
+		$bin = gmp_export($num, 1, GMP_MSW_FIRST | GMP_BIG_ENDIAN);
122
+		// if first bit is 1, prepend full zero byte
123
+		// to represent positive two's complement
124
+		if (ord($bin[0]) & 0x80) {
125
+			$bin = chr(0x00) . $bin;
126
+		}
127
+		return $bin;
128
+	}
129 129
 
130
-    /**
131
-     * Encode negative integer to DER content.
132
-     *
133
-     * @param \GMP $num
134
-     *
135
-     * @return string
136
-     */
137
-    private static function _encodeNegativeInteger(\GMP $num): string
138
-    {
139
-        $num = gmp_abs($num);
140
-        // compute number of bytes required
141
-        $width = 1;
142
-        if ($num > 128) {
143
-            $tmp = $num;
144
-            do {
145
-                ++$width;
146
-                $tmp >>= 8;
147
-            } while ($tmp > 128);
148
-        }
149
-        // compute two's complement 2^n - x
150
-        $num = gmp_pow('2', 8 * $width) - $num;
151
-        $bin = gmp_export($num, 1, GMP_MSW_FIRST | GMP_BIG_ENDIAN);
152
-        // if first bit is 0, prepend full inverted byte
153
-        // to represent negative two's complement
154
-        if (!(ord($bin[0]) & 0x80)) {
155
-            $bin = chr(0xff) . $bin;
156
-        }
157
-        return $bin;
158
-    }
130
+	/**
131
+	 * Encode negative integer to DER content.
132
+	 *
133
+	 * @param \GMP $num
134
+	 *
135
+	 * @return string
136
+	 */
137
+	private static function _encodeNegativeInteger(\GMP $num): string
138
+	{
139
+		$num = gmp_abs($num);
140
+		// compute number of bytes required
141
+		$width = 1;
142
+		if ($num > 128) {
143
+			$tmp = $num;
144
+			do {
145
+				++$width;
146
+				$tmp >>= 8;
147
+			} while ($tmp > 128);
148
+		}
149
+		// compute two's complement 2^n - x
150
+		$num = gmp_pow('2', 8 * $width) - $num;
151
+		$bin = gmp_export($num, 1, GMP_MSW_FIRST | GMP_BIG_ENDIAN);
152
+		// if first bit is 0, prepend full inverted byte
153
+		// to represent negative two's complement
154
+		if (!(ord($bin[0]) & 0x80)) {
155
+			$bin = chr(0xff) . $bin;
156
+		}
157
+		return $bin;
158
+	}
159 159
 
160
-    /**
161
-     * Test that number is valid for this context.
162
-     *
163
-     * @param mixed $num
164
-     *
165
-     * @return bool
166
-     */
167
-    private static function _validateNumber($num): bool
168
-    {
169
-        if (is_int($num)) {
170
-            return true;
171
-        }
172
-        if (is_string($num) && preg_match('/-?\d+/', $num)) {
173
-            return true;
174
-        }
175
-        return false;
176
-    }
160
+	/**
161
+	 * Test that number is valid for this context.
162
+	 *
163
+	 * @param mixed $num
164
+	 *
165
+	 * @return bool
166
+	 */
167
+	private static function _validateNumber($num): bool
168
+	{
169
+		if (is_int($num)) {
170
+			return true;
171
+		}
172
+		if (is_string($num) && preg_match('/-?\d+/', $num)) {
173
+			return true;
174
+		}
175
+		return false;
176
+	}
177 177
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\ASN1\Type\Primitive;
6 6
 
Please login to merge, or discard this patch.
lib/ASN1/Type/Constructed/Sequence.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@
 block discarded – undo
12 12
  */
13 13
 class Sequence extends Structure
14 14
 {
15
-    /**
16
-     * Constructor.
17
-     *
18
-     * @param Element ...$elements Any number of elements
19
-     */
20
-    public function __construct(Element ...$elements)
21
-    {
22
-        $this->_typeTag = self::TYPE_SEQUENCE;
23
-        parent::__construct(...$elements);
24
-    }
15
+	/**
16
+	 * Constructor.
17
+	 *
18
+	 * @param Element ...$elements Any number of elements
19
+	 */
20
+	public function __construct(Element ...$elements)
21
+	{
22
+		$this->_typeTag = self::TYPE_SEQUENCE;
23
+		parent::__construct(...$elements);
24
+	}
25 25
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\ASN1\Type\Constructed;
6 6
 
Please login to merge, or discard this patch.
lib/ASN1/Element.php 3 patches
Indentation   +436 added lines, -436 removed lines patch added patch discarded remove patch
@@ -23,467 +23,467 @@
 block discarded – undo
23 23
  */
24 24
 abstract class Element implements ElementBase
25 25
 {
26
-    // Universal type tags
27
-    const TYPE_EOC = 0x00;
28
-    const TYPE_BOOLEAN = 0x01;
29
-    const TYPE_INTEGER = 0x02;
30
-    const TYPE_BIT_STRING = 0x03;
31
-    const TYPE_OCTET_STRING = 0x04;
32
-    const TYPE_NULL = 0x05;
33
-    const TYPE_OBJECT_IDENTIFIER = 0x06;
34
-    const TYPE_OBJECT_DESCRIPTOR = 0x07;
35
-    const TYPE_EXTERNAL = 0x08;
36
-    const TYPE_REAL = 0x09;
37
-    const TYPE_ENUMERATED = 0x0a;
38
-    const TYPE_EMBEDDED_PDV = 0x0b;
39
-    const TYPE_UTF8_STRING = 0x0c;
40
-    const TYPE_RELATIVE_OID = 0x0d;
41
-    const TYPE_SEQUENCE = 0x10;
42
-    const TYPE_SET = 0x11;
43
-    const TYPE_NUMERIC_STRING = 0x12;
44
-    const TYPE_PRINTABLE_STRING = 0x13;
45
-    const TYPE_T61_STRING = 0x14;
46
-    const TYPE_VIDEOTEX_STRING = 0x15;
47
-    const TYPE_IA5_STRING = 0x16;
48
-    const TYPE_UTC_TIME = 0x17;
49
-    const TYPE_GENERALIZED_TIME = 0x18;
50
-    const TYPE_GRAPHIC_STRING = 0x19;
51
-    const TYPE_VISIBLE_STRING = 0x1a;
52
-    const TYPE_GENERAL_STRING = 0x1b;
53
-    const TYPE_UNIVERSAL_STRING = 0x1c;
54
-    const TYPE_CHARACTER_STRING = 0x1d;
55
-    const TYPE_BMP_STRING = 0x1e;
26
+	// Universal type tags
27
+	const TYPE_EOC = 0x00;
28
+	const TYPE_BOOLEAN = 0x01;
29
+	const TYPE_INTEGER = 0x02;
30
+	const TYPE_BIT_STRING = 0x03;
31
+	const TYPE_OCTET_STRING = 0x04;
32
+	const TYPE_NULL = 0x05;
33
+	const TYPE_OBJECT_IDENTIFIER = 0x06;
34
+	const TYPE_OBJECT_DESCRIPTOR = 0x07;
35
+	const TYPE_EXTERNAL = 0x08;
36
+	const TYPE_REAL = 0x09;
37
+	const TYPE_ENUMERATED = 0x0a;
38
+	const TYPE_EMBEDDED_PDV = 0x0b;
39
+	const TYPE_UTF8_STRING = 0x0c;
40
+	const TYPE_RELATIVE_OID = 0x0d;
41
+	const TYPE_SEQUENCE = 0x10;
42
+	const TYPE_SET = 0x11;
43
+	const TYPE_NUMERIC_STRING = 0x12;
44
+	const TYPE_PRINTABLE_STRING = 0x13;
45
+	const TYPE_T61_STRING = 0x14;
46
+	const TYPE_VIDEOTEX_STRING = 0x15;
47
+	const TYPE_IA5_STRING = 0x16;
48
+	const TYPE_UTC_TIME = 0x17;
49
+	const TYPE_GENERALIZED_TIME = 0x18;
50
+	const TYPE_GRAPHIC_STRING = 0x19;
51
+	const TYPE_VISIBLE_STRING = 0x1a;
52
+	const TYPE_GENERAL_STRING = 0x1b;
53
+	const TYPE_UNIVERSAL_STRING = 0x1c;
54
+	const TYPE_CHARACTER_STRING = 0x1d;
55
+	const TYPE_BMP_STRING = 0x1e;
56 56
 
57
-    /**
58
-     * Mapping from universal type tag to implementation class name.
59
-     *
60
-     * @internal
61
-     *
62
-     * @var array
63
-     */
64
-    const MAP_TAG_TO_CLASS = [
65
-        self::TYPE_EOC => Primitive\EOC::class,
66
-        self::TYPE_BOOLEAN => Primitive\Boolean::class,
67
-        self::TYPE_INTEGER => Primitive\Integer::class,
68
-        self::TYPE_BIT_STRING => Primitive\BitString::class,
69
-        self::TYPE_OCTET_STRING => Primitive\OctetString::class,
70
-        self::TYPE_NULL => Primitive\NullType::class,
71
-        self::TYPE_OBJECT_IDENTIFIER => Primitive\ObjectIdentifier::class,
72
-        self::TYPE_OBJECT_DESCRIPTOR => Primitive\ObjectDescriptor::class,
73
-        self::TYPE_REAL => Primitive\Real::class,
74
-        self::TYPE_ENUMERATED => Primitive\Enumerated::class,
75
-        self::TYPE_UTF8_STRING => Primitive\UTF8String::class,
76
-        self::TYPE_RELATIVE_OID => Primitive\RelativeOID::class,
77
-        self::TYPE_SEQUENCE => Constructed\Sequence::class,
78
-        self::TYPE_SET => Constructed\Set::class,
79
-        self::TYPE_NUMERIC_STRING => Primitive\NumericString::class,
80
-        self::TYPE_PRINTABLE_STRING => Primitive\PrintableString::class,
81
-        self::TYPE_T61_STRING => Primitive\T61String::class,
82
-        self::TYPE_VIDEOTEX_STRING => Primitive\VideotexString::class,
83
-        self::TYPE_IA5_STRING => Primitive\IA5String::class,
84
-        self::TYPE_UTC_TIME => Primitive\UTCTime::class,
85
-        self::TYPE_GENERALIZED_TIME => Primitive\GeneralizedTime::class,
86
-        self::TYPE_GRAPHIC_STRING => Primitive\GraphicString::class,
87
-        self::TYPE_VISIBLE_STRING => Primitive\VisibleString::class,
88
-        self::TYPE_GENERAL_STRING => Primitive\GeneralString::class,
89
-        self::TYPE_UNIVERSAL_STRING => Primitive\UniversalString::class,
90
-        self::TYPE_CHARACTER_STRING => Primitive\CharacterString::class,
91
-        self::TYPE_BMP_STRING => Primitive\BMPString::class,
92
-    ];
57
+	/**
58
+	 * Mapping from universal type tag to implementation class name.
59
+	 *
60
+	 * @internal
61
+	 *
62
+	 * @var array
63
+	 */
64
+	const MAP_TAG_TO_CLASS = [
65
+		self::TYPE_EOC => Primitive\EOC::class,
66
+		self::TYPE_BOOLEAN => Primitive\Boolean::class,
67
+		self::TYPE_INTEGER => Primitive\Integer::class,
68
+		self::TYPE_BIT_STRING => Primitive\BitString::class,
69
+		self::TYPE_OCTET_STRING => Primitive\OctetString::class,
70
+		self::TYPE_NULL => Primitive\NullType::class,
71
+		self::TYPE_OBJECT_IDENTIFIER => Primitive\ObjectIdentifier::class,
72
+		self::TYPE_OBJECT_DESCRIPTOR => Primitive\ObjectDescriptor::class,
73
+		self::TYPE_REAL => Primitive\Real::class,
74
+		self::TYPE_ENUMERATED => Primitive\Enumerated::class,
75
+		self::TYPE_UTF8_STRING => Primitive\UTF8String::class,
76
+		self::TYPE_RELATIVE_OID => Primitive\RelativeOID::class,
77
+		self::TYPE_SEQUENCE => Constructed\Sequence::class,
78
+		self::TYPE_SET => Constructed\Set::class,
79
+		self::TYPE_NUMERIC_STRING => Primitive\NumericString::class,
80
+		self::TYPE_PRINTABLE_STRING => Primitive\PrintableString::class,
81
+		self::TYPE_T61_STRING => Primitive\T61String::class,
82
+		self::TYPE_VIDEOTEX_STRING => Primitive\VideotexString::class,
83
+		self::TYPE_IA5_STRING => Primitive\IA5String::class,
84
+		self::TYPE_UTC_TIME => Primitive\UTCTime::class,
85
+		self::TYPE_GENERALIZED_TIME => Primitive\GeneralizedTime::class,
86
+		self::TYPE_GRAPHIC_STRING => Primitive\GraphicString::class,
87
+		self::TYPE_VISIBLE_STRING => Primitive\VisibleString::class,
88
+		self::TYPE_GENERAL_STRING => Primitive\GeneralString::class,
89
+		self::TYPE_UNIVERSAL_STRING => Primitive\UniversalString::class,
90
+		self::TYPE_CHARACTER_STRING => Primitive\CharacterString::class,
91
+		self::TYPE_BMP_STRING => Primitive\BMPString::class,
92
+	];
93 93
 
94
-    /**
95
-     * Pseudotype for all string types.
96
-     *
97
-     * May be used as an expectation parameter.
98
-     *
99
-     * @var int
100
-     */
101
-    const TYPE_STRING = -1;
94
+	/**
95
+	 * Pseudotype for all string types.
96
+	 *
97
+	 * May be used as an expectation parameter.
98
+	 *
99
+	 * @var int
100
+	 */
101
+	const TYPE_STRING = -1;
102 102
 
103
-    /**
104
-     * Pseudotype for all time types.
105
-     *
106
-     * May be used as an expectation parameter.
107
-     *
108
-     * @var int
109
-     */
110
-    const TYPE_TIME = -2;
103
+	/**
104
+	 * Pseudotype for all time types.
105
+	 *
106
+	 * May be used as an expectation parameter.
107
+	 *
108
+	 * @var int
109
+	 */
110
+	const TYPE_TIME = -2;
111 111
 
112
-    /**
113
-     * Mapping from universal type tag to human readable name.
114
-     *
115
-     * @internal
116
-     *
117
-     * @var array
118
-     */
119
-    const MAP_TYPE_TO_NAME = [
120
-        self::TYPE_EOC => 'EOC',
121
-        self::TYPE_BOOLEAN => 'BOOLEAN',
122
-        self::TYPE_INTEGER => 'INTEGER',
123
-        self::TYPE_BIT_STRING => 'BIT STRING',
124
-        self::TYPE_OCTET_STRING => 'OCTET STRING',
125
-        self::TYPE_NULL => 'NULL',
126
-        self::TYPE_OBJECT_IDENTIFIER => 'OBJECT IDENTIFIER',
127
-        self::TYPE_OBJECT_DESCRIPTOR => 'ObjectDescriptor',
128
-        self::TYPE_EXTERNAL => 'EXTERNAL',
129
-        self::TYPE_REAL => 'REAL',
130
-        self::TYPE_ENUMERATED => 'ENUMERATED',
131
-        self::TYPE_EMBEDDED_PDV => 'EMBEDDED PDV',
132
-        self::TYPE_UTF8_STRING => 'UTF8String',
133
-        self::TYPE_RELATIVE_OID => 'RELATIVE-OID',
134
-        self::TYPE_SEQUENCE => 'SEQUENCE',
135
-        self::TYPE_SET => 'SET',
136
-        self::TYPE_NUMERIC_STRING => 'NumericString',
137
-        self::TYPE_PRINTABLE_STRING => 'PrintableString',
138
-        self::TYPE_T61_STRING => 'T61String',
139
-        self::TYPE_VIDEOTEX_STRING => 'VideotexString',
140
-        self::TYPE_IA5_STRING => 'IA5String',
141
-        self::TYPE_UTC_TIME => 'UTCTime',
142
-        self::TYPE_GENERALIZED_TIME => 'GeneralizedTime',
143
-        self::TYPE_GRAPHIC_STRING => 'GraphicString',
144
-        self::TYPE_VISIBLE_STRING => 'VisibleString',
145
-        self::TYPE_GENERAL_STRING => 'GeneralString',
146
-        self::TYPE_UNIVERSAL_STRING => 'UniversalString',
147
-        self::TYPE_CHARACTER_STRING => 'CHARACTER STRING',
148
-        self::TYPE_BMP_STRING => 'BMPString',
149
-        self::TYPE_STRING => 'Any String',
150
-        self::TYPE_TIME => 'Any Time',
151
-    ];
112
+	/**
113
+	 * Mapping from universal type tag to human readable name.
114
+	 *
115
+	 * @internal
116
+	 *
117
+	 * @var array
118
+	 */
119
+	const MAP_TYPE_TO_NAME = [
120
+		self::TYPE_EOC => 'EOC',
121
+		self::TYPE_BOOLEAN => 'BOOLEAN',
122
+		self::TYPE_INTEGER => 'INTEGER',
123
+		self::TYPE_BIT_STRING => 'BIT STRING',
124
+		self::TYPE_OCTET_STRING => 'OCTET STRING',
125
+		self::TYPE_NULL => 'NULL',
126
+		self::TYPE_OBJECT_IDENTIFIER => 'OBJECT IDENTIFIER',
127
+		self::TYPE_OBJECT_DESCRIPTOR => 'ObjectDescriptor',
128
+		self::TYPE_EXTERNAL => 'EXTERNAL',
129
+		self::TYPE_REAL => 'REAL',
130
+		self::TYPE_ENUMERATED => 'ENUMERATED',
131
+		self::TYPE_EMBEDDED_PDV => 'EMBEDDED PDV',
132
+		self::TYPE_UTF8_STRING => 'UTF8String',
133
+		self::TYPE_RELATIVE_OID => 'RELATIVE-OID',
134
+		self::TYPE_SEQUENCE => 'SEQUENCE',
135
+		self::TYPE_SET => 'SET',
136
+		self::TYPE_NUMERIC_STRING => 'NumericString',
137
+		self::TYPE_PRINTABLE_STRING => 'PrintableString',
138
+		self::TYPE_T61_STRING => 'T61String',
139
+		self::TYPE_VIDEOTEX_STRING => 'VideotexString',
140
+		self::TYPE_IA5_STRING => 'IA5String',
141
+		self::TYPE_UTC_TIME => 'UTCTime',
142
+		self::TYPE_GENERALIZED_TIME => 'GeneralizedTime',
143
+		self::TYPE_GRAPHIC_STRING => 'GraphicString',
144
+		self::TYPE_VISIBLE_STRING => 'VisibleString',
145
+		self::TYPE_GENERAL_STRING => 'GeneralString',
146
+		self::TYPE_UNIVERSAL_STRING => 'UniversalString',
147
+		self::TYPE_CHARACTER_STRING => 'CHARACTER STRING',
148
+		self::TYPE_BMP_STRING => 'BMPString',
149
+		self::TYPE_STRING => 'Any String',
150
+		self::TYPE_TIME => 'Any Time',
151
+	];
152 152
 
153
-    /**
154
-     * Element's type tag.
155
-     *
156
-     * @var int
157
-     */
158
-    protected $_typeTag;
153
+	/**
154
+	 * Element's type tag.
155
+	 *
156
+	 * @var int
157
+	 */
158
+	protected $_typeTag;
159 159
 
160
-    /**
161
-     * Whether type shall be encoded with indefinite length.
162
-     *
163
-     * @var bool
164
-     */
165
-    protected $_indefiniteLength = false;
160
+	/**
161
+	 * Whether type shall be encoded with indefinite length.
162
+	 *
163
+	 * @var bool
164
+	 */
165
+	protected $_indefiniteLength = false;
166 166
 
167
-    /**
168
-     * {@inheritdoc}
169
-     */
170
-    abstract public function typeClass(): int;
167
+	/**
168
+	 * {@inheritdoc}
169
+	 */
170
+	abstract public function typeClass(): int;
171 171
 
172
-    /**
173
-     * {@inheritdoc}
174
-     */
175
-    abstract public function isConstructed(): bool;
172
+	/**
173
+	 * {@inheritdoc}
174
+	 */
175
+	abstract public function isConstructed(): bool;
176 176
 
177
-    /**
178
-     * Decode element from DER data.
179
-     *
180
-     * @param string   $data   DER encoded data
181
-     * @param null|int $offset Reference to the variable that contains offset
182
-     *                         into the data where to start parsing.
183
-     *                         Variable is updated to the offset next to the
184
-     *                         parsed element. If null, start from offset 0.
185
-     *
186
-     * @throws DecodeException           If decoding fails
187
-     * @throws \UnexpectedValueException If called in the context of an expected
188
-     *                                   type, but decoding yields another type
189
-     *
190
-     * @return ElementBase
191
-     */
192
-    public static function fromDER(string $data, int &$offset = null): ElementBase
193
-    {
194
-        $idx = $offset ?? 0;
195
-        // decode identifier
196
-        $identifier = Identifier::fromDER($data, $idx);
197
-        // determine class that implements type specific decoding
198
-        $cls = self::_determineImplClass($identifier);
199
-        try {
200
-            // decode remaining element
201
-            $element = $cls::_decodeFromDER($identifier, $data, $idx);
202
-        } catch (\LogicException $e) {
203
-            // rethrow as a RuntimeException for unified exception handling
204
-            throw new DecodeException(
205
-                sprintf('Error while decoding %s.',
206
-                    self::tagToName($identifier->intTag())), 0, $e);
207
-        }
208
-        // if called in the context of a concrete class, check
209
-        // that decoded type matches the type of a calling class
210
-        $called_class = get_called_class();
211
-        if (self::class != $called_class) {
212
-            if (!$element instanceof $called_class) {
213
-                throw new \UnexpectedValueException(
214
-                    sprintf('%s expected, got %s.', $called_class,
215
-                        get_class($element)));
216
-            }
217
-        }
218
-        // update offset for the caller
219
-        if (isset($offset)) {
220
-            $offset = $idx;
221
-        }
222
-        return $element;
223
-    }
177
+	/**
178
+	 * Decode element from DER data.
179
+	 *
180
+	 * @param string   $data   DER encoded data
181
+	 * @param null|int $offset Reference to the variable that contains offset
182
+	 *                         into the data where to start parsing.
183
+	 *                         Variable is updated to the offset next to the
184
+	 *                         parsed element. If null, start from offset 0.
185
+	 *
186
+	 * @throws DecodeException           If decoding fails
187
+	 * @throws \UnexpectedValueException If called in the context of an expected
188
+	 *                                   type, but decoding yields another type
189
+	 *
190
+	 * @return ElementBase
191
+	 */
192
+	public static function fromDER(string $data, int &$offset = null): ElementBase
193
+	{
194
+		$idx = $offset ?? 0;
195
+		// decode identifier
196
+		$identifier = Identifier::fromDER($data, $idx);
197
+		// determine class that implements type specific decoding
198
+		$cls = self::_determineImplClass($identifier);
199
+		try {
200
+			// decode remaining element
201
+			$element = $cls::_decodeFromDER($identifier, $data, $idx);
202
+		} catch (\LogicException $e) {
203
+			// rethrow as a RuntimeException for unified exception handling
204
+			throw new DecodeException(
205
+				sprintf('Error while decoding %s.',
206
+					self::tagToName($identifier->intTag())), 0, $e);
207
+		}
208
+		// if called in the context of a concrete class, check
209
+		// that decoded type matches the type of a calling class
210
+		$called_class = get_called_class();
211
+		if (self::class != $called_class) {
212
+			if (!$element instanceof $called_class) {
213
+				throw new \UnexpectedValueException(
214
+					sprintf('%s expected, got %s.', $called_class,
215
+						get_class($element)));
216
+			}
217
+		}
218
+		// update offset for the caller
219
+		if (isset($offset)) {
220
+			$offset = $idx;
221
+		}
222
+		return $element;
223
+	}
224 224
 
225
-    /**
226
-     * {@inheritdoc}
227
-     */
228
-    public function toDER(): string
229
-    {
230
-        $identifier = new Identifier($this->typeClass(),
231
-            $this->isConstructed() ? Identifier::CONSTRUCTED : Identifier::PRIMITIVE,
232
-            $this->_typeTag);
233
-        $content = $this->_encodedContentDER();
234
-        if ($this->_indefiniteLength) {
235
-            $length = new Length(0, true);
236
-            $eoc = new Primitive\EOC();
237
-            return $identifier->toDER() . $length->toDER() . $content .
238
-                $eoc->toDER();
239
-        }
240
-        $length = new Length(strlen($content));
241
-        return $identifier->toDER() . $length->toDER() . $content;
242
-    }
225
+	/**
226
+	 * {@inheritdoc}
227
+	 */
228
+	public function toDER(): string
229
+	{
230
+		$identifier = new Identifier($this->typeClass(),
231
+			$this->isConstructed() ? Identifier::CONSTRUCTED : Identifier::PRIMITIVE,
232
+			$this->_typeTag);
233
+		$content = $this->_encodedContentDER();
234
+		if ($this->_indefiniteLength) {
235
+			$length = new Length(0, true);
236
+			$eoc = new Primitive\EOC();
237
+			return $identifier->toDER() . $length->toDER() . $content .
238
+				$eoc->toDER();
239
+		}
240
+		$length = new Length(strlen($content));
241
+		return $identifier->toDER() . $length->toDER() . $content;
242
+	}
243 243
 
244
-    /**
245
-     * {@inheritdoc}
246
-     */
247
-    public function tag(): int
248
-    {
249
-        return $this->_typeTag;
250
-    }
244
+	/**
245
+	 * {@inheritdoc}
246
+	 */
247
+	public function tag(): int
248
+	{
249
+		return $this->_typeTag;
250
+	}
251 251
 
252
-    /**
253
-     * {@inheritdoc}
254
-     */
255
-    public function isType(int $tag): bool
256
-    {
257
-        // if element is context specific
258
-        if (Identifier::CLASS_CONTEXT_SPECIFIC === $this->typeClass()) {
259
-            return false;
260
-        }
261
-        // negative tags identify an abstract pseudotype
262
-        if ($tag < 0) {
263
-            return $this->_isPseudoType($tag);
264
-        }
265
-        return $this->_isConcreteType($tag);
266
-    }
252
+	/**
253
+	 * {@inheritdoc}
254
+	 */
255
+	public function isType(int $tag): bool
256
+	{
257
+		// if element is context specific
258
+		if (Identifier::CLASS_CONTEXT_SPECIFIC === $this->typeClass()) {
259
+			return false;
260
+		}
261
+		// negative tags identify an abstract pseudotype
262
+		if ($tag < 0) {
263
+			return $this->_isPseudoType($tag);
264
+		}
265
+		return $this->_isConcreteType($tag);
266
+	}
267 267
 
268
-    /**
269
-     * {@inheritdoc}
270
-     */
271
-    public function expectType(int $tag): ElementBase
272
-    {
273
-        if (!$this->isType($tag)) {
274
-            throw new \UnexpectedValueException(
275
-                sprintf('%s expected, got %s.', self::tagToName($tag),
276
-                    $this->_typeDescriptorString()));
277
-        }
278
-        return $this;
279
-    }
268
+	/**
269
+	 * {@inheritdoc}
270
+	 */
271
+	public function expectType(int $tag): ElementBase
272
+	{
273
+		if (!$this->isType($tag)) {
274
+			throw new \UnexpectedValueException(
275
+				sprintf('%s expected, got %s.', self::tagToName($tag),
276
+					$this->_typeDescriptorString()));
277
+		}
278
+		return $this;
279
+	}
280 280
 
281
-    /**
282
-     * {@inheritdoc}
283
-     */
284
-    public function isTagged(): bool
285
-    {
286
-        return $this instanceof TaggedType;
287
-    }
281
+	/**
282
+	 * {@inheritdoc}
283
+	 */
284
+	public function isTagged(): bool
285
+	{
286
+		return $this instanceof TaggedType;
287
+	}
288 288
 
289
-    /**
290
-     * {@inheritdoc}
291
-     */
292
-    public function expectTagged(?int $tag = null): TaggedType
293
-    {
294
-        if (!$this->isTagged()) {
295
-            throw new \UnexpectedValueException(
296
-                sprintf('Context specific element expected, got %s.',
297
-                    Identifier::classToName($this->typeClass())));
298
-        }
299
-        if (isset($tag) && $this->tag() !== $tag) {
300
-            throw new \UnexpectedValueException(
301
-                sprintf('Tag %d expected, got %d.', $tag, $this->tag()));
302
-        }
303
-        return $this;
304
-    }
289
+	/**
290
+	 * {@inheritdoc}
291
+	 */
292
+	public function expectTagged(?int $tag = null): TaggedType
293
+	{
294
+		if (!$this->isTagged()) {
295
+			throw new \UnexpectedValueException(
296
+				sprintf('Context specific element expected, got %s.',
297
+					Identifier::classToName($this->typeClass())));
298
+		}
299
+		if (isset($tag) && $this->tag() !== $tag) {
300
+			throw new \UnexpectedValueException(
301
+				sprintf('Tag %d expected, got %d.', $tag, $this->tag()));
302
+		}
303
+		return $this;
304
+	}
305 305
 
306
-    /**
307
-     * Whether element has indefinite length.
308
-     *
309
-     * @return bool
310
-     */
311
-    public function hasIndefiniteLength(): bool
312
-    {
313
-        return $this->_indefiniteLength;
314
-    }
306
+	/**
307
+	 * Whether element has indefinite length.
308
+	 *
309
+	 * @return bool
310
+	 */
311
+	public function hasIndefiniteLength(): bool
312
+	{
313
+		return $this->_indefiniteLength;
314
+	}
315 315
 
316
-    /**
317
-     * Get self with indefinite length encoding set.
318
-     *
319
-     * @param bool $indefinite True for indefinite length, false for definite
320
-     *                         length
321
-     *
322
-     * @return self
323
-     */
324
-    public function withIndefiniteLength(bool $indefinite = true): self
325
-    {
326
-        $obj = clone $this;
327
-        $obj->_indefiniteLength = $indefinite;
328
-        return $obj;
329
-    }
316
+	/**
317
+	 * Get self with indefinite length encoding set.
318
+	 *
319
+	 * @param bool $indefinite True for indefinite length, false for definite
320
+	 *                         length
321
+	 *
322
+	 * @return self
323
+	 */
324
+	public function withIndefiniteLength(bool $indefinite = true): self
325
+	{
326
+		$obj = clone $this;
327
+		$obj->_indefiniteLength = $indefinite;
328
+		return $obj;
329
+	}
330 330
 
331
-    /**
332
-     * {@inheritdoc}
333
-     */
334
-    final public function asElement(): Element
335
-    {
336
-        return $this;
337
-    }
331
+	/**
332
+	 * {@inheritdoc}
333
+	 */
334
+	final public function asElement(): Element
335
+	{
336
+		return $this;
337
+	}
338 338
 
339
-    /**
340
-     * Get element decorated with UnspecifiedType object.
341
-     *
342
-     * @return UnspecifiedType
343
-     */
344
-    public function asUnspecified(): UnspecifiedType
345
-    {
346
-        return new UnspecifiedType($this);
347
-    }
339
+	/**
340
+	 * Get element decorated with UnspecifiedType object.
341
+	 *
342
+	 * @return UnspecifiedType
343
+	 */
344
+	public function asUnspecified(): UnspecifiedType
345
+	{
346
+		return new UnspecifiedType($this);
347
+	}
348 348
 
349
-    /**
350
-     * Get human readable name for an universal tag.
351
-     *
352
-     * @param int $tag
353
-     *
354
-     * @return string
355
-     */
356
-    public static function tagToName(int $tag): string
357
-    {
358
-        if (!array_key_exists($tag, self::MAP_TYPE_TO_NAME)) {
359
-            return "TAG ${tag}";
360
-        }
361
-        return self::MAP_TYPE_TO_NAME[$tag];
362
-    }
349
+	/**
350
+	 * Get human readable name for an universal tag.
351
+	 *
352
+	 * @param int $tag
353
+	 *
354
+	 * @return string
355
+	 */
356
+	public static function tagToName(int $tag): string
357
+	{
358
+		if (!array_key_exists($tag, self::MAP_TYPE_TO_NAME)) {
359
+			return "TAG ${tag}";
360
+		}
361
+		return self::MAP_TYPE_TO_NAME[$tag];
362
+	}
363 363
 
364
-    /**
365
-     * Get the content encoded in DER.
366
-     *
367
-     * Returns the DER encoded content without identifier and length header
368
-     * octets.
369
-     *
370
-     * @return string
371
-     */
372
-    abstract protected function _encodedContentDER(): string;
364
+	/**
365
+	 * Get the content encoded in DER.
366
+	 *
367
+	 * Returns the DER encoded content without identifier and length header
368
+	 * octets.
369
+	 *
370
+	 * @return string
371
+	 */
372
+	abstract protected function _encodedContentDER(): string;
373 373
 
374
-    /**
375
-     * Decode type-specific element from DER.
376
-     *
377
-     * @param Identifier $identifier Pre-parsed identifier
378
-     * @param string     $data       DER data
379
-     * @param int        $offset     Offset in data to the next byte after identifier
380
-     *
381
-     * @throws DecodeException If decoding fails
382
-     *
383
-     * @return ElementBase
384
-     */
385
-    protected static function _decodeFromDER(Identifier $identifier,
386
-        string $data, int &$offset): ElementBase
387
-    {
388
-        throw new \BadMethodCallException(
389
-            __METHOD__ . ' must be implemented in derived class.');
390
-    }
374
+	/**
375
+	 * Decode type-specific element from DER.
376
+	 *
377
+	 * @param Identifier $identifier Pre-parsed identifier
378
+	 * @param string     $data       DER data
379
+	 * @param int        $offset     Offset in data to the next byte after identifier
380
+	 *
381
+	 * @throws DecodeException If decoding fails
382
+	 *
383
+	 * @return ElementBase
384
+	 */
385
+	protected static function _decodeFromDER(Identifier $identifier,
386
+		string $data, int &$offset): ElementBase
387
+	{
388
+		throw new \BadMethodCallException(
389
+			__METHOD__ . ' must be implemented in derived class.');
390
+	}
391 391
 
392
-    /**
393
-     * Determine the class that implements the type.
394
-     *
395
-     * @param Identifier $identifier
396
-     *
397
-     * @return string Class name
398
-     */
399
-    protected static function _determineImplClass(Identifier $identifier): string
400
-    {
401
-        switch ($identifier->typeClass()) {
402
-            case Identifier::CLASS_UNIVERSAL:
403
-                return self::_determineUniversalImplClass($identifier->intTag());
404
-            case Identifier::CLASS_CONTEXT_SPECIFIC:
405
-                return ContextSpecificType::class;
406
-            case Identifier::CLASS_APPLICATION:
407
-                return ApplicationType::class;
408
-            case Identifier::CLASS_PRIVATE:
409
-                return PrivateType::class;
410
-        }
411
-        throw new \UnexpectedValueException(
412
-            sprintf('%s %d not implemented.',
413
-                Identifier::classToName($identifier->typeClass()),
414
-                $identifier->tag()));
415
-    }
392
+	/**
393
+	 * Determine the class that implements the type.
394
+	 *
395
+	 * @param Identifier $identifier
396
+	 *
397
+	 * @return string Class name
398
+	 */
399
+	protected static function _determineImplClass(Identifier $identifier): string
400
+	{
401
+		switch ($identifier->typeClass()) {
402
+			case Identifier::CLASS_UNIVERSAL:
403
+				return self::_determineUniversalImplClass($identifier->intTag());
404
+			case Identifier::CLASS_CONTEXT_SPECIFIC:
405
+				return ContextSpecificType::class;
406
+			case Identifier::CLASS_APPLICATION:
407
+				return ApplicationType::class;
408
+			case Identifier::CLASS_PRIVATE:
409
+				return PrivateType::class;
410
+		}
411
+		throw new \UnexpectedValueException(
412
+			sprintf('%s %d not implemented.',
413
+				Identifier::classToName($identifier->typeClass()),
414
+				$identifier->tag()));
415
+	}
416 416
 
417
-    /**
418
-     * Determine the class that implements an universal type of the given tag.
419
-     *
420
-     * @param int $tag
421
-     *
422
-     * @throws \UnexpectedValueException
423
-     *
424
-     * @return string Class name
425
-     */
426
-    protected static function _determineUniversalImplClass(int $tag): string
427
-    {
428
-        if (!array_key_exists($tag, self::MAP_TAG_TO_CLASS)) {
429
-            throw new \UnexpectedValueException(
430
-                "Universal tag ${tag} not implemented.");
431
-        }
432
-        return self::MAP_TAG_TO_CLASS[$tag];
433
-    }
417
+	/**
418
+	 * Determine the class that implements an universal type of the given tag.
419
+	 *
420
+	 * @param int $tag
421
+	 *
422
+	 * @throws \UnexpectedValueException
423
+	 *
424
+	 * @return string Class name
425
+	 */
426
+	protected static function _determineUniversalImplClass(int $tag): string
427
+	{
428
+		if (!array_key_exists($tag, self::MAP_TAG_TO_CLASS)) {
429
+			throw new \UnexpectedValueException(
430
+				"Universal tag ${tag} not implemented.");
431
+		}
432
+		return self::MAP_TAG_TO_CLASS[$tag];
433
+	}
434 434
 
435
-    /**
436
-     * Get textual description of the type for debugging purposes.
437
-     *
438
-     * @return string
439
-     */
440
-    protected function _typeDescriptorString(): string
441
-    {
442
-        if (Identifier::CLASS_UNIVERSAL == $this->typeClass()) {
443
-            return self::tagToName($this->_typeTag);
444
-        }
445
-        return sprintf('%s TAG %d', Identifier::classToName($this->typeClass()),
446
-            $this->_typeTag);
447
-    }
435
+	/**
436
+	 * Get textual description of the type for debugging purposes.
437
+	 *
438
+	 * @return string
439
+	 */
440
+	protected function _typeDescriptorString(): string
441
+	{
442
+		if (Identifier::CLASS_UNIVERSAL == $this->typeClass()) {
443
+			return self::tagToName($this->_typeTag);
444
+		}
445
+		return sprintf('%s TAG %d', Identifier::classToName($this->typeClass()),
446
+			$this->_typeTag);
447
+	}
448 448
 
449
-    /**
450
-     * Check whether the element is a concrete type of a given tag.
451
-     *
452
-     * @param int $tag
453
-     *
454
-     * @return bool
455
-     */
456
-    private function _isConcreteType(int $tag): bool
457
-    {
458
-        // if tag doesn't match
459
-        if ($this->tag() != $tag) {
460
-            return false;
461
-        }
462
-        // if type is universal check that instance is of a correct class
463
-        if (Identifier::CLASS_UNIVERSAL == $this->typeClass()) {
464
-            $cls = self::_determineUniversalImplClass($tag);
465
-            if (!$this instanceof $cls) {
466
-                return false;
467
-            }
468
-        }
469
-        return true;
470
-    }
449
+	/**
450
+	 * Check whether the element is a concrete type of a given tag.
451
+	 *
452
+	 * @param int $tag
453
+	 *
454
+	 * @return bool
455
+	 */
456
+	private function _isConcreteType(int $tag): bool
457
+	{
458
+		// if tag doesn't match
459
+		if ($this->tag() != $tag) {
460
+			return false;
461
+		}
462
+		// if type is universal check that instance is of a correct class
463
+		if (Identifier::CLASS_UNIVERSAL == $this->typeClass()) {
464
+			$cls = self::_determineUniversalImplClass($tag);
465
+			if (!$this instanceof $cls) {
466
+				return false;
467
+			}
468
+		}
469
+		return true;
470
+	}
471 471
 
472
-    /**
473
-     * Check whether the element is a pseudotype.
474
-     *
475
-     * @param int $tag
476
-     *
477
-     * @return bool
478
-     */
479
-    private function _isPseudoType(int $tag): bool
480
-    {
481
-        switch ($tag) {
482
-            case self::TYPE_STRING:
483
-                return $this instanceof StringType;
484
-            case self::TYPE_TIME:
485
-                return $this instanceof TimeType;
486
-        }
487
-        return false;
488
-    }
472
+	/**
473
+	 * Check whether the element is a pseudotype.
474
+	 *
475
+	 * @param int $tag
476
+	 *
477
+	 * @return bool
478
+	 */
479
+	private function _isPseudoType(int $tag): bool
480
+	{
481
+		switch ($tag) {
482
+			case self::TYPE_STRING:
483
+				return $this instanceof StringType;
484
+			case self::TYPE_TIME:
485
+				return $this instanceof TimeType;
486
+		}
487
+		return false;
488
+	}
489 489
 }
Please login to merge, or discard this patch.
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -399,14 +399,14 @@  discard block
 block discarded – undo
399 399
     protected static function _determineImplClass(Identifier $identifier): string
400 400
     {
401 401
         switch ($identifier->typeClass()) {
402
-            case Identifier::CLASS_UNIVERSAL:
403
-                return self::_determineUniversalImplClass($identifier->intTag());
404
-            case Identifier::CLASS_CONTEXT_SPECIFIC:
405
-                return ContextSpecificType::class;
406
-            case Identifier::CLASS_APPLICATION:
407
-                return ApplicationType::class;
408
-            case Identifier::CLASS_PRIVATE:
409
-                return PrivateType::class;
402
+        case Identifier::CLASS_UNIVERSAL:
403
+            return self::_determineUniversalImplClass($identifier->intTag());
404
+        case Identifier::CLASS_CONTEXT_SPECIFIC:
405
+            return ContextSpecificType::class;
406
+        case Identifier::CLASS_APPLICATION:
407
+            return ApplicationType::class;
408
+        case Identifier::CLASS_PRIVATE:
409
+            return PrivateType::class;
410 410
         }
411 411
         throw new \UnexpectedValueException(
412 412
             sprintf('%s %d not implemented.',
@@ -479,10 +479,10 @@  discard block
 block discarded – undo
479 479
     private function _isPseudoType(int $tag): bool
480 480
     {
481 481
         switch ($tag) {
482
-            case self::TYPE_STRING:
483
-                return $this instanceof StringType;
484
-            case self::TYPE_TIME:
485
-                return $this instanceof TimeType;
482
+        case self::TYPE_STRING:
483
+            return $this instanceof StringType;
484
+        case self::TYPE_TIME:
485
+            return $this instanceof TimeType;
486 486
         }
487 487
         return false;
488 488
     }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\ASN1;
6 6
 
Please login to merge, or discard this patch.
lib/ASN1/Type/Constructed/Set.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -12,56 +12,56 @@
 block discarded – undo
12 12
  */
13 13
 class Set extends Structure
14 14
 {
15
-    /**
16
-     * Constructor.
17
-     *
18
-     * @param Element ...$elements Any number of elements
19
-     */
20
-    public function __construct(Element ...$elements)
21
-    {
22
-        $this->_typeTag = self::TYPE_SET;
23
-        parent::__construct(...$elements);
24
-    }
15
+	/**
16
+	 * Constructor.
17
+	 *
18
+	 * @param Element ...$elements Any number of elements
19
+	 */
20
+	public function __construct(Element ...$elements)
21
+	{
22
+		$this->_typeTag = self::TYPE_SET;
23
+		parent::__construct(...$elements);
24
+	}
25 25
 
26
-    /**
27
-     * Sort by canonical ascending order.
28
-     * 
29
-     * Used for DER encoding of SET type.
30
-     *
31
-     * @return self
32
-     */
33
-    public function sortedSet(): self
34
-    {
35
-        $obj = clone $this;
36
-        usort($obj->_elements,
37
-            function (Element $a, Element $b) {
38
-                if ($a->typeClass() != $b->typeClass()) {
39
-                    return $a->typeClass() < $b->typeClass() ? -1 : 1;
40
-                }
41
-                if ($a->tag() == $b->tag()) {
42
-                    return 0;
43
-                }
44
-                return $a->tag() < $b->tag() ? -1 : 1;
45
-            });
46
-        return $obj;
47
-    }
26
+	/**
27
+	 * Sort by canonical ascending order.
28
+	 * 
29
+	 * Used for DER encoding of SET type.
30
+	 *
31
+	 * @return self
32
+	 */
33
+	public function sortedSet(): self
34
+	{
35
+		$obj = clone $this;
36
+		usort($obj->_elements,
37
+			function (Element $a, Element $b) {
38
+				if ($a->typeClass() != $b->typeClass()) {
39
+					return $a->typeClass() < $b->typeClass() ? -1 : 1;
40
+				}
41
+				if ($a->tag() == $b->tag()) {
42
+					return 0;
43
+				}
44
+				return $a->tag() < $b->tag() ? -1 : 1;
45
+			});
46
+		return $obj;
47
+	}
48 48
 
49
-    /**
50
-     * Sort by encoding ascending order.
51
-     * 
52
-     * Used for DER encoding of SET OF type.
53
-     *
54
-     * @return self
55
-     */
56
-    public function sortedSetOf(): self
57
-    {
58
-        $obj = clone $this;
59
-        usort($obj->_elements,
60
-            function (Element $a, Element $b) {
61
-                $a_der = $a->toDER();
62
-                $b_der = $b->toDER();
63
-                return strcmp($a_der, $b_der);
64
-            });
65
-        return $obj;
66
-    }
49
+	/**
50
+	 * Sort by encoding ascending order.
51
+	 * 
52
+	 * Used for DER encoding of SET OF type.
53
+	 *
54
+	 * @return self
55
+	 */
56
+	public function sortedSetOf(): self
57
+	{
58
+		$obj = clone $this;
59
+		usort($obj->_elements,
60
+			function (Element $a, Element $b) {
61
+				$a_der = $a->toDER();
62
+				$b_der = $b->toDER();
63
+				return strcmp($a_der, $b_der);
64
+			});
65
+		return $obj;
66
+	}
67 67
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\ASN1\Type\Constructed;
6 6
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         $obj = clone $this;
36 36
         usort($obj->_elements,
37
-            function (Element $a, Element $b) {
37
+            function(Element $a, Element $b) {
38 38
                 if ($a->typeClass() != $b->typeClass()) {
39 39
                     return $a->typeClass() < $b->typeClass() ? -1 : 1;
40 40
                 }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     {
58 58
         $obj = clone $this;
59 59
         usort($obj->_elements,
60
-            function (Element $a, Element $b) {
60
+            function(Element $a, Element $b) {
61 61
                 $a_der = $a->toDER();
62 62
                 $b_der = $b->toDER();
63 63
                 return strcmp($a_der, $b_der);
Please login to merge, or discard this patch.