@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Sop\ASN1\Component; |
6 | 6 |
@@ -13,223 +13,223 @@ |
||
13 | 13 | */ |
14 | 14 | class Length implements Encodable |
15 | 15 | { |
16 | - /** |
|
17 | - * Length. |
|
18 | - * |
|
19 | - * @var BigInt |
|
20 | - */ |
|
21 | - private $_length; |
|
16 | + /** |
|
17 | + * Length. |
|
18 | + * |
|
19 | + * @var BigInt |
|
20 | + */ |
|
21 | + private $_length; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Whether length is indefinite. |
|
25 | - * |
|
26 | - * @var bool |
|
27 | - */ |
|
28 | - private $_indefinite; |
|
23 | + /** |
|
24 | + * Whether length is indefinite. |
|
25 | + * |
|
26 | + * @var bool |
|
27 | + */ |
|
28 | + private $_indefinite; |
|
29 | 29 | |
30 | - /** |
|
31 | - * Constructor. |
|
32 | - * |
|
33 | - * @param int|string $length Length |
|
34 | - * @param bool $indefinite Whether length is indefinite |
|
35 | - */ |
|
36 | - public function __construct($length, bool $indefinite = false) |
|
37 | - { |
|
38 | - $this->_length = new BigInt($length); |
|
39 | - $this->_indefinite = $indefinite; |
|
40 | - } |
|
30 | + /** |
|
31 | + * Constructor. |
|
32 | + * |
|
33 | + * @param int|string $length Length |
|
34 | + * @param bool $indefinite Whether length is indefinite |
|
35 | + */ |
|
36 | + public function __construct($length, bool $indefinite = false) |
|
37 | + { |
|
38 | + $this->_length = new BigInt($length); |
|
39 | + $this->_indefinite = $indefinite; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Decode length component from DER data. |
|
44 | - * |
|
45 | - * @param string $data DER encoded data |
|
46 | - * @param null|int $offset Reference to the variable that contains offset |
|
47 | - * into the data where to start parsing. |
|
48 | - * Variable is updated to the offset next to the |
|
49 | - * parsed length component. If null, start from offset 0. |
|
50 | - * |
|
51 | - * @throws DecodeException If decoding fails |
|
52 | - * |
|
53 | - * @return self |
|
54 | - */ |
|
55 | - public static function fromDER(string $data, int &$offset = null): self |
|
56 | - { |
|
57 | - $idx = $offset ?? 0; |
|
58 | - $datalen = strlen($data); |
|
59 | - if ($idx >= $datalen) { |
|
60 | - throw new DecodeException( |
|
61 | - 'Unexpected end of data while decoding length.'); |
|
62 | - } |
|
63 | - $indefinite = false; |
|
64 | - $byte = ord($data[$idx++]); |
|
65 | - // bits 7 to 1 |
|
66 | - $length = (0x7f & $byte); |
|
67 | - // long form |
|
68 | - if (0x80 & $byte) { |
|
69 | - if (!$length) { |
|
70 | - $indefinite = true; |
|
71 | - } else { |
|
72 | - if ($idx + $length > $datalen) { |
|
73 | - throw new DecodeException( |
|
74 | - 'Unexpected end of data while decoding long form length.'); |
|
75 | - } |
|
76 | - $length = self::_decodeLongFormLength($length, $data, $idx); |
|
77 | - } |
|
78 | - } |
|
79 | - if (isset($offset)) { |
|
80 | - $offset = $idx; |
|
81 | - } |
|
82 | - return new self($length, $indefinite); |
|
83 | - } |
|
42 | + /** |
|
43 | + * Decode length component from DER data. |
|
44 | + * |
|
45 | + * @param string $data DER encoded data |
|
46 | + * @param null|int $offset Reference to the variable that contains offset |
|
47 | + * into the data where to start parsing. |
|
48 | + * Variable is updated to the offset next to the |
|
49 | + * parsed length component. If null, start from offset 0. |
|
50 | + * |
|
51 | + * @throws DecodeException If decoding fails |
|
52 | + * |
|
53 | + * @return self |
|
54 | + */ |
|
55 | + public static function fromDER(string $data, int &$offset = null): self |
|
56 | + { |
|
57 | + $idx = $offset ?? 0; |
|
58 | + $datalen = strlen($data); |
|
59 | + if ($idx >= $datalen) { |
|
60 | + throw new DecodeException( |
|
61 | + 'Unexpected end of data while decoding length.'); |
|
62 | + } |
|
63 | + $indefinite = false; |
|
64 | + $byte = ord($data[$idx++]); |
|
65 | + // bits 7 to 1 |
|
66 | + $length = (0x7f & $byte); |
|
67 | + // long form |
|
68 | + if (0x80 & $byte) { |
|
69 | + if (!$length) { |
|
70 | + $indefinite = true; |
|
71 | + } else { |
|
72 | + if ($idx + $length > $datalen) { |
|
73 | + throw new DecodeException( |
|
74 | + 'Unexpected end of data while decoding long form length.'); |
|
75 | + } |
|
76 | + $length = self::_decodeLongFormLength($length, $data, $idx); |
|
77 | + } |
|
78 | + } |
|
79 | + if (isset($offset)) { |
|
80 | + $offset = $idx; |
|
81 | + } |
|
82 | + return new self($length, $indefinite); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * Decode length from DER. |
|
87 | - * |
|
88 | - * Throws an exception if length doesn't match with expected or if data |
|
89 | - * doesn't contain enough bytes. |
|
90 | - * |
|
91 | - * Requirement of definite length is relaxed contrary to the specification |
|
92 | - * (sect. 10.1). |
|
93 | - * |
|
94 | - * @see self::fromDER |
|
95 | - * |
|
96 | - * @param string $data DER data |
|
97 | - * @param int $offset Reference to the offset variable |
|
98 | - * @param null|int $expected Expected length, null to bypass checking |
|
99 | - * |
|
100 | - * @throws DecodeException If decoding or expectation fails |
|
101 | - * |
|
102 | - * @return self |
|
103 | - */ |
|
104 | - public static function expectFromDER(string $data, int &$offset, |
|
105 | - int $expected = null): self |
|
106 | - { |
|
107 | - $idx = $offset; |
|
108 | - $length = self::fromDER($data, $idx); |
|
109 | - // if certain length was expected |
|
110 | - if (isset($expected)) { |
|
111 | - if ($length->isIndefinite()) { |
|
112 | - throw new DecodeException('Expected length %d, got indefinite.', |
|
113 | - $expected); |
|
114 | - } |
|
115 | - if ($expected !== $length->intLength()) { |
|
116 | - throw new DecodeException( |
|
117 | - sprintf('Expected length %d, got %d.', $expected, |
|
118 | - $length->intLength())); |
|
119 | - } |
|
120 | - } |
|
121 | - // check that enough data is available |
|
122 | - if (!$length->isIndefinite() && |
|
123 | - strlen($data) < $idx + $length->intLength()) { |
|
124 | - throw new DecodeException( |
|
125 | - sprintf('Length %d overflows data, %d bytes left.', |
|
126 | - $length->intLength(), strlen($data) - $idx)); |
|
127 | - } |
|
128 | - $offset = $idx; |
|
129 | - return $length; |
|
130 | - } |
|
85 | + /** |
|
86 | + * Decode length from DER. |
|
87 | + * |
|
88 | + * Throws an exception if length doesn't match with expected or if data |
|
89 | + * doesn't contain enough bytes. |
|
90 | + * |
|
91 | + * Requirement of definite length is relaxed contrary to the specification |
|
92 | + * (sect. 10.1). |
|
93 | + * |
|
94 | + * @see self::fromDER |
|
95 | + * |
|
96 | + * @param string $data DER data |
|
97 | + * @param int $offset Reference to the offset variable |
|
98 | + * @param null|int $expected Expected length, null to bypass checking |
|
99 | + * |
|
100 | + * @throws DecodeException If decoding or expectation fails |
|
101 | + * |
|
102 | + * @return self |
|
103 | + */ |
|
104 | + public static function expectFromDER(string $data, int &$offset, |
|
105 | + int $expected = null): self |
|
106 | + { |
|
107 | + $idx = $offset; |
|
108 | + $length = self::fromDER($data, $idx); |
|
109 | + // if certain length was expected |
|
110 | + if (isset($expected)) { |
|
111 | + if ($length->isIndefinite()) { |
|
112 | + throw new DecodeException('Expected length %d, got indefinite.', |
|
113 | + $expected); |
|
114 | + } |
|
115 | + if ($expected !== $length->intLength()) { |
|
116 | + throw new DecodeException( |
|
117 | + sprintf('Expected length %d, got %d.', $expected, |
|
118 | + $length->intLength())); |
|
119 | + } |
|
120 | + } |
|
121 | + // check that enough data is available |
|
122 | + if (!$length->isIndefinite() && |
|
123 | + strlen($data) < $idx + $length->intLength()) { |
|
124 | + throw new DecodeException( |
|
125 | + sprintf('Length %d overflows data, %d bytes left.', |
|
126 | + $length->intLength(), strlen($data) - $idx)); |
|
127 | + } |
|
128 | + $offset = $idx; |
|
129 | + return $length; |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * {@inheritdoc} |
|
134 | - * |
|
135 | - * @throws \DomainException If length is too large to encode |
|
136 | - */ |
|
137 | - public function toDER(): string |
|
138 | - { |
|
139 | - $bytes = []; |
|
140 | - if ($this->_indefinite) { |
|
141 | - $bytes[] = 0x80; |
|
142 | - } else { |
|
143 | - $num = $this->_length->gmpObj(); |
|
144 | - // long form |
|
145 | - if ($num > 127) { |
|
146 | - $octets = []; |
|
147 | - for (; $num > 0; $num >>= 8) { |
|
148 | - $octets[] = gmp_intval(0xff & $num); |
|
149 | - } |
|
150 | - $count = count($octets); |
|
151 | - // first octet must not be 0xff |
|
152 | - if ($count >= 127) { |
|
153 | - throw new \DomainException('Too many length octets.'); |
|
154 | - } |
|
155 | - $bytes[] = 0x80 | $count; |
|
156 | - foreach (array_reverse($octets) as $octet) { |
|
157 | - $bytes[] = $octet; |
|
158 | - } |
|
159 | - } |
|
160 | - // short form |
|
161 | - else { |
|
162 | - $bytes[] = gmp_intval($num); |
|
163 | - } |
|
164 | - } |
|
165 | - return pack('C*', ...$bytes); |
|
166 | - } |
|
132 | + /** |
|
133 | + * {@inheritdoc} |
|
134 | + * |
|
135 | + * @throws \DomainException If length is too large to encode |
|
136 | + */ |
|
137 | + public function toDER(): string |
|
138 | + { |
|
139 | + $bytes = []; |
|
140 | + if ($this->_indefinite) { |
|
141 | + $bytes[] = 0x80; |
|
142 | + } else { |
|
143 | + $num = $this->_length->gmpObj(); |
|
144 | + // long form |
|
145 | + if ($num > 127) { |
|
146 | + $octets = []; |
|
147 | + for (; $num > 0; $num >>= 8) { |
|
148 | + $octets[] = gmp_intval(0xff & $num); |
|
149 | + } |
|
150 | + $count = count($octets); |
|
151 | + // first octet must not be 0xff |
|
152 | + if ($count >= 127) { |
|
153 | + throw new \DomainException('Too many length octets.'); |
|
154 | + } |
|
155 | + $bytes[] = 0x80 | $count; |
|
156 | + foreach (array_reverse($octets) as $octet) { |
|
157 | + $bytes[] = $octet; |
|
158 | + } |
|
159 | + } |
|
160 | + // short form |
|
161 | + else { |
|
162 | + $bytes[] = gmp_intval($num); |
|
163 | + } |
|
164 | + } |
|
165 | + return pack('C*', ...$bytes); |
|
166 | + } |
|
167 | 167 | |
168 | - /** |
|
169 | - * Get the length. |
|
170 | - * |
|
171 | - * @throws \LogicException If length is indefinite |
|
172 | - * |
|
173 | - * @return string Length as an integer string |
|
174 | - */ |
|
175 | - public function length(): string |
|
176 | - { |
|
177 | - if ($this->_indefinite) { |
|
178 | - throw new \LogicException('Length is indefinite.'); |
|
179 | - } |
|
180 | - return $this->_length->base10(); |
|
181 | - } |
|
168 | + /** |
|
169 | + * Get the length. |
|
170 | + * |
|
171 | + * @throws \LogicException If length is indefinite |
|
172 | + * |
|
173 | + * @return string Length as an integer string |
|
174 | + */ |
|
175 | + public function length(): string |
|
176 | + { |
|
177 | + if ($this->_indefinite) { |
|
178 | + throw new \LogicException('Length is indefinite.'); |
|
179 | + } |
|
180 | + return $this->_length->base10(); |
|
181 | + } |
|
182 | 182 | |
183 | - /** |
|
184 | - * Get the length as an integer. |
|
185 | - * |
|
186 | - * @throws \LogicException If length is indefinite |
|
187 | - * @throws \RuntimeException If length overflows integer size |
|
188 | - * |
|
189 | - * @return int |
|
190 | - */ |
|
191 | - public function intLength(): int |
|
192 | - { |
|
193 | - if ($this->_indefinite) { |
|
194 | - throw new \LogicException('Length is indefinite.'); |
|
195 | - } |
|
196 | - return $this->_length->intVal(); |
|
197 | - } |
|
183 | + /** |
|
184 | + * Get the length as an integer. |
|
185 | + * |
|
186 | + * @throws \LogicException If length is indefinite |
|
187 | + * @throws \RuntimeException If length overflows integer size |
|
188 | + * |
|
189 | + * @return int |
|
190 | + */ |
|
191 | + public function intLength(): int |
|
192 | + { |
|
193 | + if ($this->_indefinite) { |
|
194 | + throw new \LogicException('Length is indefinite.'); |
|
195 | + } |
|
196 | + return $this->_length->intVal(); |
|
197 | + } |
|
198 | 198 | |
199 | - /** |
|
200 | - * Whether length is indefinite. |
|
201 | - * |
|
202 | - * @return bool |
|
203 | - */ |
|
204 | - public function isIndefinite(): bool |
|
205 | - { |
|
206 | - return $this->_indefinite; |
|
207 | - } |
|
199 | + /** |
|
200 | + * Whether length is indefinite. |
|
201 | + * |
|
202 | + * @return bool |
|
203 | + */ |
|
204 | + public function isIndefinite(): bool |
|
205 | + { |
|
206 | + return $this->_indefinite; |
|
207 | + } |
|
208 | 208 | |
209 | - /** |
|
210 | - * Decode long form length. |
|
211 | - * |
|
212 | - * @param int $length Number of octets |
|
213 | - * @param string $data Data |
|
214 | - * @param int $offset reference to the variable containing offset to the data |
|
215 | - * |
|
216 | - * @throws DecodeException If decoding fails |
|
217 | - * |
|
218 | - * @return string Integer as a string |
|
219 | - */ |
|
220 | - private static function _decodeLongFormLength(int $length, string $data, |
|
221 | - int &$offset): string |
|
222 | - { |
|
223 | - // first octet must not be 0xff (spec 8.1.3.5c) |
|
224 | - if (127 === $length) { |
|
225 | - throw new DecodeException('Invalid number of length octets.'); |
|
226 | - } |
|
227 | - $num = gmp_init(0, 10); |
|
228 | - while (--$length >= 0) { |
|
229 | - $byte = ord($data[$offset++]); |
|
230 | - $num <<= 8; |
|
231 | - $num |= $byte; |
|
232 | - } |
|
233 | - return gmp_strval($num); |
|
234 | - } |
|
209 | + /** |
|
210 | + * Decode long form length. |
|
211 | + * |
|
212 | + * @param int $length Number of octets |
|
213 | + * @param string $data Data |
|
214 | + * @param int $offset reference to the variable containing offset to the data |
|
215 | + * |
|
216 | + * @throws DecodeException If decoding fails |
|
217 | + * |
|
218 | + * @return string Integer as a string |
|
219 | + */ |
|
220 | + private static function _decodeLongFormLength(int $length, string $data, |
|
221 | + int &$offset): string |
|
222 | + { |
|
223 | + // first octet must not be 0xff (spec 8.1.3.5c) |
|
224 | + if (127 === $length) { |
|
225 | + throw new DecodeException('Invalid number of length octets.'); |
|
226 | + } |
|
227 | + $num = gmp_init(0, 10); |
|
228 | + while (--$length >= 0) { |
|
229 | + $byte = ord($data[$offset++]); |
|
230 | + $num <<= 8; |
|
231 | + $num |= $byte; |
|
232 | + } |
|
233 | + return gmp_strval($num); |
|
234 | + } |
|
235 | 235 | } |
@@ -1,6 +1,6 @@ |
||
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 |
@@ -13,90 +13,90 @@ |
||
13 | 13 | */ |
14 | 14 | interface ElementBase extends Encodable |
15 | 15 | { |
16 | - /** |
|
17 | - * Get the class of the ASN.1 type. |
|
18 | - * |
|
19 | - * One of `Identifier::CLASS_*` constants. |
|
20 | - * |
|
21 | - * @return int |
|
22 | - */ |
|
23 | - public function typeClass(): int; |
|
16 | + /** |
|
17 | + * Get the class of the ASN.1 type. |
|
18 | + * |
|
19 | + * One of `Identifier::CLASS_*` constants. |
|
20 | + * |
|
21 | + * @return int |
|
22 | + */ |
|
23 | + public function typeClass(): int; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Check whether the element is constructed. |
|
27 | - * |
|
28 | - * Otherwise it's primitive. |
|
29 | - * |
|
30 | - * @return bool |
|
31 | - */ |
|
32 | - public function isConstructed(): bool; |
|
25 | + /** |
|
26 | + * Check whether the element is constructed. |
|
27 | + * |
|
28 | + * Otherwise it's primitive. |
|
29 | + * |
|
30 | + * @return bool |
|
31 | + */ |
|
32 | + public function isConstructed(): bool; |
|
33 | 33 | |
34 | - /** |
|
35 | - * Get the tag of the element. |
|
36 | - * |
|
37 | - * Interpretation of the tag depends on the context. For example it may |
|
38 | - * represent a universal type tag or a tag of an implicitly or explicitly |
|
39 | - * tagged type. |
|
40 | - * |
|
41 | - * @return int |
|
42 | - */ |
|
43 | - public function tag(): int; |
|
34 | + /** |
|
35 | + * Get the tag of the element. |
|
36 | + * |
|
37 | + * Interpretation of the tag depends on the context. For example it may |
|
38 | + * represent a universal type tag or a tag of an implicitly or explicitly |
|
39 | + * tagged type. |
|
40 | + * |
|
41 | + * @return int |
|
42 | + */ |
|
43 | + public function tag(): int; |
|
44 | 44 | |
45 | - /** |
|
46 | - * Check whether the element is a type of a given tag. |
|
47 | - * |
|
48 | - * @param int $tag Type tag |
|
49 | - * |
|
50 | - * @return bool |
|
51 | - */ |
|
52 | - public function isType(int $tag): bool; |
|
45 | + /** |
|
46 | + * Check whether the element is a type of a given tag. |
|
47 | + * |
|
48 | + * @param int $tag Type tag |
|
49 | + * |
|
50 | + * @return bool |
|
51 | + */ |
|
52 | + public function isType(int $tag): bool; |
|
53 | 53 | |
54 | - /** |
|
55 | - * Check whether the element is a type of a given tag. |
|
56 | - * |
|
57 | - * Throws an exception if expectation fails. |
|
58 | - * |
|
59 | - * @param int $tag Type tag |
|
60 | - * |
|
61 | - * @throws \UnexpectedValueException If the element type differs from the expected |
|
62 | - * |
|
63 | - * @return ElementBase |
|
64 | - */ |
|
65 | - public function expectType(int $tag): ElementBase; |
|
54 | + /** |
|
55 | + * Check whether the element is a type of a given tag. |
|
56 | + * |
|
57 | + * Throws an exception if expectation fails. |
|
58 | + * |
|
59 | + * @param int $tag Type tag |
|
60 | + * |
|
61 | + * @throws \UnexpectedValueException If the element type differs from the expected |
|
62 | + * |
|
63 | + * @return ElementBase |
|
64 | + */ |
|
65 | + public function expectType(int $tag): ElementBase; |
|
66 | 66 | |
67 | - /** |
|
68 | - * Check whether the element is tagged (context specific). |
|
69 | - * |
|
70 | - * @return bool |
|
71 | - */ |
|
72 | - public function isTagged(): bool; |
|
67 | + /** |
|
68 | + * Check whether the element is tagged (context specific). |
|
69 | + * |
|
70 | + * @return bool |
|
71 | + */ |
|
72 | + public function isTagged(): bool; |
|
73 | 73 | |
74 | - /** |
|
75 | - * Check whether the element is tagged (context specific) and optionally has |
|
76 | - * a given tag. |
|
77 | - * |
|
78 | - * Throws an exception if the element is not tagged or tag differs from |
|
79 | - * the expected. |
|
80 | - * |
|
81 | - * @param null|int $tag Optional type tag |
|
82 | - * |
|
83 | - * @throws \UnexpectedValueException If expectation fails |
|
84 | - * |
|
85 | - * @return TaggedType |
|
86 | - */ |
|
87 | - public function expectTagged(?int $tag = null): TaggedType; |
|
74 | + /** |
|
75 | + * Check whether the element is tagged (context specific) and optionally has |
|
76 | + * a given tag. |
|
77 | + * |
|
78 | + * Throws an exception if the element is not tagged or tag differs from |
|
79 | + * the expected. |
|
80 | + * |
|
81 | + * @param null|int $tag Optional type tag |
|
82 | + * |
|
83 | + * @throws \UnexpectedValueException If expectation fails |
|
84 | + * |
|
85 | + * @return TaggedType |
|
86 | + */ |
|
87 | + public function expectTagged(?int $tag = null): TaggedType; |
|
88 | 88 | |
89 | - /** |
|
90 | - * Get the object as an abstract `Element` instance. |
|
91 | - * |
|
92 | - * @return Element |
|
93 | - */ |
|
94 | - public function asElement(): Element; |
|
89 | + /** |
|
90 | + * Get the object as an abstract `Element` instance. |
|
91 | + * |
|
92 | + * @return Element |
|
93 | + */ |
|
94 | + public function asElement(): Element; |
|
95 | 95 | |
96 | - /** |
|
97 | - * Get the object as an `UnspecifiedType` instance. |
|
98 | - * |
|
99 | - * @return UnspecifiedType |
|
100 | - */ |
|
101 | - public function asUnspecified(): UnspecifiedType; |
|
96 | + /** |
|
97 | + * Get the object as an `UnspecifiedType` instance. |
|
98 | + * |
|
99 | + * @return UnspecifiedType |
|
100 | + */ |
|
101 | + public function asUnspecified(): UnspecifiedType; |
|
102 | 102 | } |
@@ -1,6 +1,6 @@ discard block |
||
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 |
||
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 |
||
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); |
@@ -12,56 +12,56 @@ |
||
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 | } |
@@ -1,6 +1,6 @@ discard block |
||
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 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function strings(): array |
101 | 101 | { |
102 | - return array_map(function (StringType $el) { |
|
102 | + return array_map(function(StringType $el) { |
|
103 | 103 | return $el->string(); |
104 | 104 | }, $this->_elements); |
105 | 105 | } |
@@ -31,106 +31,106 @@ |
||
31 | 31 | */ |
32 | 32 | class ConstructedString extends Structure implements StringType |
33 | 33 | { |
34 | - /** |
|
35 | - * Constructor. |
|
36 | - * |
|
37 | - * @internal Use `create()` or `createWithTag()` method instead |
|
38 | - * |
|
39 | - * @param Element ...$elements Any number of elements |
|
40 | - */ |
|
41 | - protected function __construct(Element ...$elements) |
|
42 | - { |
|
43 | - parent::__construct(...$elements); |
|
44 | - } |
|
34 | + /** |
|
35 | + * Constructor. |
|
36 | + * |
|
37 | + * @internal Use `create()` or `createWithTag()` method instead |
|
38 | + * |
|
39 | + * @param Element ...$elements Any number of elements |
|
40 | + */ |
|
41 | + protected function __construct(Element ...$elements) |
|
42 | + { |
|
43 | + parent::__construct(...$elements); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * {@inheritdoc} |
|
48 | - */ |
|
49 | - public function __toString(): string |
|
50 | - { |
|
51 | - return $this->string(); |
|
52 | - } |
|
46 | + /** |
|
47 | + * {@inheritdoc} |
|
48 | + */ |
|
49 | + public function __toString(): string |
|
50 | + { |
|
51 | + return $this->string(); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Create from a list of string type elements. |
|
56 | - * |
|
57 | - * All strings must have the same type. |
|
58 | - * |
|
59 | - * @param StringType ...$elements |
|
60 | - * |
|
61 | - * @throws \LogicException |
|
62 | - * |
|
63 | - * @return self |
|
64 | - */ |
|
65 | - public static function create(StringType ...$elements): self |
|
66 | - { |
|
67 | - if (!count($elements)) { |
|
68 | - throw new \LogicException( |
|
69 | - 'No elements, unable to determine type tag.'); |
|
70 | - } |
|
71 | - $tag = $elements[0]->tag(); |
|
72 | - foreach ($elements as $el) { |
|
73 | - if ($el->tag() !== $tag) { |
|
74 | - throw new \LogicException( |
|
75 | - 'All elements in constructed string must have the same type.'); |
|
76 | - } |
|
77 | - } |
|
78 | - return self::createWithTag($tag, ...$elements); |
|
79 | - } |
|
54 | + /** |
|
55 | + * Create from a list of string type elements. |
|
56 | + * |
|
57 | + * All strings must have the same type. |
|
58 | + * |
|
59 | + * @param StringType ...$elements |
|
60 | + * |
|
61 | + * @throws \LogicException |
|
62 | + * |
|
63 | + * @return self |
|
64 | + */ |
|
65 | + public static function create(StringType ...$elements): self |
|
66 | + { |
|
67 | + if (!count($elements)) { |
|
68 | + throw new \LogicException( |
|
69 | + 'No elements, unable to determine type tag.'); |
|
70 | + } |
|
71 | + $tag = $elements[0]->tag(); |
|
72 | + foreach ($elements as $el) { |
|
73 | + if ($el->tag() !== $tag) { |
|
74 | + throw new \LogicException( |
|
75 | + 'All elements in constructed string must have the same type.'); |
|
76 | + } |
|
77 | + } |
|
78 | + return self::createWithTag($tag, ...$elements); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * Create from strings with a given type tag. |
|
83 | - * |
|
84 | - * Does not perform any validation on types. |
|
85 | - * |
|
86 | - * @param int $tag Type tag for the constructed string element |
|
87 | - * @param StringType ...$elements Any number of elements |
|
88 | - * |
|
89 | - * @return self |
|
90 | - */ |
|
91 | - public static function createWithTag(int $tag, StringType ...$elements) |
|
92 | - { |
|
93 | - $el = new self(...$elements); |
|
94 | - $el->_typeTag = $tag; |
|
95 | - return $el; |
|
96 | - } |
|
81 | + /** |
|
82 | + * Create from strings with a given type tag. |
|
83 | + * |
|
84 | + * Does not perform any validation on types. |
|
85 | + * |
|
86 | + * @param int $tag Type tag for the constructed string element |
|
87 | + * @param StringType ...$elements Any number of elements |
|
88 | + * |
|
89 | + * @return self |
|
90 | + */ |
|
91 | + public static function createWithTag(int $tag, StringType ...$elements) |
|
92 | + { |
|
93 | + $el = new self(...$elements); |
|
94 | + $el->_typeTag = $tag; |
|
95 | + return $el; |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * Get a list of strings in this structure. |
|
100 | - * |
|
101 | - * @return string[] |
|
102 | - */ |
|
103 | - public function strings(): array |
|
104 | - { |
|
105 | - return array_map(function (StringType $el) { |
|
106 | - return $el->string(); |
|
107 | - }, $this->_elements); |
|
108 | - } |
|
98 | + /** |
|
99 | + * Get a list of strings in this structure. |
|
100 | + * |
|
101 | + * @return string[] |
|
102 | + */ |
|
103 | + public function strings(): array |
|
104 | + { |
|
105 | + return array_map(function (StringType $el) { |
|
106 | + return $el->string(); |
|
107 | + }, $this->_elements); |
|
108 | + } |
|
109 | 109 | |
110 | - /** |
|
111 | - * Get the contained strings concatenated together. |
|
112 | - * |
|
113 | - * NOTE: It's unclear how bit strings with unused bits should be concatenated. |
|
114 | - * |
|
115 | - * @return string |
|
116 | - */ |
|
117 | - public function string(): string |
|
118 | - { |
|
119 | - return implode('', $this->strings()); |
|
120 | - } |
|
110 | + /** |
|
111 | + * Get the contained strings concatenated together. |
|
112 | + * |
|
113 | + * NOTE: It's unclear how bit strings with unused bits should be concatenated. |
|
114 | + * |
|
115 | + * @return string |
|
116 | + */ |
|
117 | + public function string(): string |
|
118 | + { |
|
119 | + return implode('', $this->strings()); |
|
120 | + } |
|
121 | 121 | |
122 | - /** |
|
123 | - * {@inheritdoc} |
|
124 | - * |
|
125 | - * @return self |
|
126 | - */ |
|
127 | - protected static function _decodeFromDER(Identifier $identifier, |
|
128 | - string $data, int &$offset): ElementBase |
|
129 | - { |
|
130 | - /** @var ConstructedString $type */ |
|
131 | - $type = forward_static_call_array([parent::class, __FUNCTION__], |
|
132 | - [$identifier, $data, &$offset]); |
|
133 | - $type->_typeTag = $identifier->intTag(); |
|
134 | - return $type; |
|
135 | - } |
|
122 | + /** |
|
123 | + * {@inheritdoc} |
|
124 | + * |
|
125 | + * @return self |
|
126 | + */ |
|
127 | + protected static function _decodeFromDER(Identifier $identifier, |
|
128 | + string $data, int &$offset): ElementBase |
|
129 | + { |
|
130 | + /** @var ConstructedString $type */ |
|
131 | + $type = forward_static_call_array([parent::class, __FUNCTION__], |
|
132 | + [$identifier, $data, &$offset]); |
|
133 | + $type->_typeTag = $identifier->intTag(); |
|
134 | + return $type; |
|
135 | + } |
|
136 | 136 | } |
@@ -9,17 +9,17 @@ |
||
9 | 9 | */ |
10 | 10 | interface Stringable |
11 | 11 | { |
12 | - /** |
|
13 | - * Convert object to string. |
|
14 | - * |
|
15 | - * @return string |
|
16 | - */ |
|
17 | - public function __toString(): string; |
|
12 | + /** |
|
13 | + * Convert object to string. |
|
14 | + * |
|
15 | + * @return string |
|
16 | + */ |
|
17 | + public function __toString(): string; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Get the string representation of the type. |
|
21 | - * |
|
22 | - * @return string |
|
23 | - */ |
|
24 | - public function string(): string; |
|
19 | + /** |
|
20 | + * Get the string representation of the type. |
|
21 | + * |
|
22 | + * @return string |
|
23 | + */ |
|
24 | + public function string(): string; |
|
25 | 25 | } |
@@ -1,6 +1,6 @@ |
||
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 |
@@ -11,58 +11,58 @@ |
||
11 | 11 | */ |
12 | 12 | abstract class BaseString extends Element implements StringType |
13 | 13 | { |
14 | - /** |
|
15 | - * String value. |
|
16 | - * |
|
17 | - * @var string |
|
18 | - */ |
|
19 | - protected $_string; |
|
14 | + /** |
|
15 | + * String value. |
|
16 | + * |
|
17 | + * @var string |
|
18 | + */ |
|
19 | + protected $_string; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Constructor. |
|
23 | - * |
|
24 | - * @param string $string |
|
25 | - * |
|
26 | - * @throws \InvalidArgumentException |
|
27 | - */ |
|
28 | - public function __construct(string $string) |
|
29 | - { |
|
30 | - if (!$this->_validateString($string)) { |
|
31 | - throw new \InvalidArgumentException( |
|
32 | - sprintf('Not a valid %s string.', |
|
33 | - self::tagToName($this->_typeTag))); |
|
34 | - } |
|
35 | - $this->_string = $string; |
|
36 | - } |
|
21 | + /** |
|
22 | + * Constructor. |
|
23 | + * |
|
24 | + * @param string $string |
|
25 | + * |
|
26 | + * @throws \InvalidArgumentException |
|
27 | + */ |
|
28 | + public function __construct(string $string) |
|
29 | + { |
|
30 | + if (!$this->_validateString($string)) { |
|
31 | + throw new \InvalidArgumentException( |
|
32 | + sprintf('Not a valid %s string.', |
|
33 | + self::tagToName($this->_typeTag))); |
|
34 | + } |
|
35 | + $this->_string = $string; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * {@inheritdoc} |
|
40 | - */ |
|
41 | - public function __toString(): string |
|
42 | - { |
|
43 | - return $this->string(); |
|
44 | - } |
|
38 | + /** |
|
39 | + * {@inheritdoc} |
|
40 | + */ |
|
41 | + public function __toString(): string |
|
42 | + { |
|
43 | + return $this->string(); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Get the string value. |
|
48 | - * |
|
49 | - * @return string |
|
50 | - */ |
|
51 | - public function string(): string |
|
52 | - { |
|
53 | - return $this->_string; |
|
54 | - } |
|
46 | + /** |
|
47 | + * Get the string value. |
|
48 | + * |
|
49 | + * @return string |
|
50 | + */ |
|
51 | + public function string(): string |
|
52 | + { |
|
53 | + return $this->_string; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Check whether string is valid for the concrete type. |
|
58 | - * |
|
59 | - * @param string $string |
|
60 | - * |
|
61 | - * @return bool |
|
62 | - */ |
|
63 | - protected function _validateString(string $string): bool |
|
64 | - { |
|
65 | - // Override in derived classes |
|
66 | - return true; |
|
67 | - } |
|
56 | + /** |
|
57 | + * Check whether string is valid for the concrete type. |
|
58 | + * |
|
59 | + * @param string $string |
|
60 | + * |
|
61 | + * @return bool |
|
62 | + */ |
|
63 | + protected function _validateString(string $string): bool |
|
64 | + { |
|
65 | + // Override in derived classes |
|
66 | + return true; |
|
67 | + } |
|
68 | 68 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Sop\ASN1\Type; |
6 | 6 |
@@ -11,111 +11,111 @@ |
||
11 | 11 | */ |
12 | 12 | abstract class BaseTime extends Element implements TimeType |
13 | 13 | { |
14 | - /** |
|
15 | - * UTC timezone. |
|
16 | - * |
|
17 | - * @var string |
|
18 | - */ |
|
19 | - const TZ_UTC = 'UTC'; |
|
14 | + /** |
|
15 | + * UTC timezone. |
|
16 | + * |
|
17 | + * @var string |
|
18 | + */ |
|
19 | + const TZ_UTC = 'UTC'; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Date and time. |
|
23 | - * |
|
24 | - * @var \DateTimeImmutable |
|
25 | - */ |
|
26 | - protected $_dateTime; |
|
21 | + /** |
|
22 | + * Date and time. |
|
23 | + * |
|
24 | + * @var \DateTimeImmutable |
|
25 | + */ |
|
26 | + protected $_dateTime; |
|
27 | 27 | |
28 | - /** |
|
29 | - * Constructor. |
|
30 | - * |
|
31 | - * @param \DateTimeImmutable $dt |
|
32 | - */ |
|
33 | - public function __construct(\DateTimeImmutable $dt) |
|
34 | - { |
|
35 | - $this->_dateTime = $dt; |
|
36 | - } |
|
28 | + /** |
|
29 | + * Constructor. |
|
30 | + * |
|
31 | + * @param \DateTimeImmutable $dt |
|
32 | + */ |
|
33 | + public function __construct(\DateTimeImmutable $dt) |
|
34 | + { |
|
35 | + $this->_dateTime = $dt; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * {@inheritdoc} |
|
40 | - */ |
|
41 | - public function __toString(): string |
|
42 | - { |
|
43 | - return $this->string(); |
|
44 | - } |
|
38 | + /** |
|
39 | + * {@inheritdoc} |
|
40 | + */ |
|
41 | + public function __toString(): string |
|
42 | + { |
|
43 | + return $this->string(); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Initialize from datetime string. |
|
48 | - * |
|
49 | - * @see http://php.net/manual/en/datetime.formats.php |
|
50 | - * |
|
51 | - * @param string $time Time string |
|
52 | - * @param null|string $tz timezone, if null use default |
|
53 | - * |
|
54 | - * @throws \RuntimeException |
|
55 | - * |
|
56 | - * @return self |
|
57 | - */ |
|
58 | - public static function fromString(string $time, ?string $tz = null): self |
|
59 | - { |
|
60 | - try { |
|
61 | - if (!isset($tz)) { |
|
62 | - $tz = date_default_timezone_get(); |
|
63 | - } |
|
64 | - return new static( |
|
65 | - new \DateTimeImmutable($time, self::_createTimeZone($tz))); |
|
66 | - } catch (\Exception $e) { |
|
67 | - throw new \RuntimeException( |
|
68 | - 'Failed to create DateTime: ' . |
|
69 | - self::_getLastDateTimeImmutableErrorsStr(), 0, $e); |
|
70 | - } |
|
71 | - } |
|
46 | + /** |
|
47 | + * Initialize from datetime string. |
|
48 | + * |
|
49 | + * @see http://php.net/manual/en/datetime.formats.php |
|
50 | + * |
|
51 | + * @param string $time Time string |
|
52 | + * @param null|string $tz timezone, if null use default |
|
53 | + * |
|
54 | + * @throws \RuntimeException |
|
55 | + * |
|
56 | + * @return self |
|
57 | + */ |
|
58 | + public static function fromString(string $time, ?string $tz = null): self |
|
59 | + { |
|
60 | + try { |
|
61 | + if (!isset($tz)) { |
|
62 | + $tz = date_default_timezone_get(); |
|
63 | + } |
|
64 | + return new static( |
|
65 | + new \DateTimeImmutable($time, self::_createTimeZone($tz))); |
|
66 | + } catch (\Exception $e) { |
|
67 | + throw new \RuntimeException( |
|
68 | + 'Failed to create DateTime: ' . |
|
69 | + self::_getLastDateTimeImmutableErrorsStr(), 0, $e); |
|
70 | + } |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Get the date and time. |
|
75 | - * |
|
76 | - * @return \DateTimeImmutable |
|
77 | - */ |
|
78 | - public function dateTime(): \DateTimeImmutable |
|
79 | - { |
|
80 | - return $this->_dateTime; |
|
81 | - } |
|
73 | + /** |
|
74 | + * Get the date and time. |
|
75 | + * |
|
76 | + * @return \DateTimeImmutable |
|
77 | + */ |
|
78 | + public function dateTime(): \DateTimeImmutable |
|
79 | + { |
|
80 | + return $this->_dateTime; |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * Get the date and time as a type specific string. |
|
85 | - * |
|
86 | - * @return string |
|
87 | - */ |
|
88 | - public function string(): string |
|
89 | - { |
|
90 | - return $this->_encodedContentDER(); |
|
91 | - } |
|
83 | + /** |
|
84 | + * Get the date and time as a type specific string. |
|
85 | + * |
|
86 | + * @return string |
|
87 | + */ |
|
88 | + public function string(): string |
|
89 | + { |
|
90 | + return $this->_encodedContentDER(); |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * Create `DateTimeZone` object from string. |
|
95 | - * |
|
96 | - * @param string $tz |
|
97 | - * |
|
98 | - * @throws \UnexpectedValueException If timezone is invalid |
|
99 | - * |
|
100 | - * @return \DateTimeZone |
|
101 | - */ |
|
102 | - protected static function _createTimeZone(string $tz): \DateTimeZone |
|
103 | - { |
|
104 | - try { |
|
105 | - return new \DateTimeZone($tz); |
|
106 | - } catch (\Exception $e) { |
|
107 | - throw new \UnexpectedValueException('Invalid timezone.', 0, $e); |
|
108 | - } |
|
109 | - } |
|
93 | + /** |
|
94 | + * Create `DateTimeZone` object from string. |
|
95 | + * |
|
96 | + * @param string $tz |
|
97 | + * |
|
98 | + * @throws \UnexpectedValueException If timezone is invalid |
|
99 | + * |
|
100 | + * @return \DateTimeZone |
|
101 | + */ |
|
102 | + protected static function _createTimeZone(string $tz): \DateTimeZone |
|
103 | + { |
|
104 | + try { |
|
105 | + return new \DateTimeZone($tz); |
|
106 | + } catch (\Exception $e) { |
|
107 | + throw new \UnexpectedValueException('Invalid timezone.', 0, $e); |
|
108 | + } |
|
109 | + } |
|
110 | 110 | |
111 | - /** |
|
112 | - * Get last error caused by `DateTimeImmutable`. |
|
113 | - * |
|
114 | - * @return string |
|
115 | - */ |
|
116 | - protected static function _getLastDateTimeImmutableErrorsStr(): string |
|
117 | - { |
|
118 | - $errors = \DateTimeImmutable::getLastErrors()['errors']; |
|
119 | - return implode(', ', $errors); |
|
120 | - } |
|
111 | + /** |
|
112 | + * Get last error caused by `DateTimeImmutable`. |
|
113 | + * |
|
114 | + * @return string |
|
115 | + */ |
|
116 | + protected static function _getLastDateTimeImmutableErrorsStr(): string |
|
117 | + { |
|
118 | + $errors = \DateTimeImmutable::getLastErrors()['errors']; |
|
119 | + return implode(', ', $errors); |
|
120 | + } |
|
121 | 121 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Sop\ASN1\Type; |
6 | 6 |