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.
Test Failed
Push — master ( 405cf3...79c9ba )
by Joni
04:48
created
lib/X509/Certificate/Extension/Extension.php 1 patch
Indentation   +258 added lines, -258 removed lines patch added patch discarded remove patch
@@ -18,277 +18,277 @@
 block discarded – undo
18 18
  */
19 19
 abstract class Extension
20 20
 {
21
-    // OID's from standard certificate extensions
22
-    const OID_OBSOLETE_AUTHORITY_KEY_IDENTIFIER = '2.5.29.1';
23
-    const OID_OBSOLETE_KEY_ATTRIBUTES = '2.5.29.2';
24
-    const OID_OBSOLETE_CERTIFICATE_POLICIES = '2.5.29.3';
25
-    const OID_OBSOLETE_KEY_USAGE_RESTRICTION = '2.5.29.4';
26
-    const OID_OBSOLETE_POLICY_MAPPING = '2.5.29.5';
27
-    const OID_OBSOLETE_SUBTREES_CONSTRAINT = '2.5.29.6';
28
-    const OID_OBSOLETE_SUBJECT_ALT_NAME = '2.5.29.7';
29
-    const OID_OBSOLETE_ISSUER_ALT_NAME = '2.5.29.8';
30
-    const OID_SUBJECT_DIRECTORY_ATTRIBUTES = '2.5.29.9';
31
-    const OID_OBSOLETE_BASIC_CONSTRAINTS = '2.5.29.10';
32
-    const OID_SUBJECT_KEY_IDENTIFIER = '2.5.29.14';
33
-    const OID_KEY_USAGE = '2.5.29.15';
34
-    const OID_PRIVATE_KEY_USAGE_PERIOD = '2.5.29.16';
35
-    const OID_SUBJECT_ALT_NAME = '2.5.29.17';
36
-    const OID_ISSUER_ALT_NAME = '2.5.29.18';
37
-    const OID_BASIC_CONSTRAINTS = '2.5.29.19';
38
-    const OID_CRL_NUMBER = '2.5.29.20';
39
-    const OID_REASON_CODE = '2.5.29.21';
40
-    const OID_OBSOLETE_EXPIRATION_DATE = '2.5.29.22';
41
-    const OID_INSTRUCTION_CODE = '2.5.29.23';
42
-    const OID_INVALIDITY_DATE = '2.5.29.24';
43
-    const OID_OBSOLETE_CRL_DISTRIBUTION_POINTS = '2.5.29.25';
44
-    const OID_OBSOLETE_ISSUING_DISTRIBUTION_POINT = '2.5.29.26';
45
-    const OID_DELTA_CRL_INDICATOR = '2.5.29.27';
46
-    const OID_ISSUING_DISTRIBUTION_POINT = '2.5.29.28';
47
-    const OID_CERTIFICATE_ISSUER = '2.5.29.29';
48
-    const OID_NAME_CONSTRAINTS = '2.5.29.30';
49
-    const OID_CRL_DISTRIBUTION_POINTS = '2.5.29.31';
50
-    const OID_CERTIFICATE_POLICIES = '2.5.29.32';
51
-    const OID_POLICY_MAPPINGS = '2.5.29.33';
52
-    const OID_OBSOLETE_POLICY_CONSTRAINTS = '2.5.29.34';
53
-    const OID_AUTHORITY_KEY_IDENTIFIER = '2.5.29.35';
54
-    const OID_POLICY_CONSTRAINTS = '2.5.29.36';
55
-    const OID_EXT_KEY_USAGE = '2.5.29.37';
56
-    const OID_AUTHORITY_ATTRIBUTE_IDENTIFIER = '2.5.29.38';
57
-    const OID_ROLE_SPEC_CERT_IDENTIFIER = '2.5.29.39';
58
-    const OID_CRL_STREAM_IDENTIFIER = '2.5.29.40';
59
-    const OID_BASIC_ATT_CONSTRAINTS = '2.5.29.41';
60
-    const OID_DELEGATED_NAME_CONSTRAINTS = '2.5.29.42';
61
-    const OID_TIME_SPECIFICATION = '2.5.29.43';
62
-    const OID_CRL_SCOPE = '2.5.29.44';
63
-    const OID_STATUS_REFERRALS = '2.5.29.45';
64
-    const OID_FRESHEST_CRL = '2.5.29.46';
65
-    const OID_ORDERED_LIST = '2.5.29.47';
66
-    const OID_ATTRIBUTE_DESCRIPTOR = '2.5.29.48';
67
-    const OID_USER_NOTICE = '2.5.29.49';
68
-    const OID_SOA_IDENTIFIER = '2.5.29.50';
69
-    const OID_BASE_UPDATE_TIME = '2.5.29.51';
70
-    const OID_ACCEPTABLE_CERT_POLICIES = '2.5.29.52';
71
-    const OID_DELTA_INFO = '2.5.29.53';
72
-    const OID_INHIBIT_ANY_POLICY = '2.5.29.54';
73
-    const OID_TARGET_INFORMATION = '2.5.29.55';
74
-    const OID_NO_REV_AVAIL = '2.5.29.56';
75
-    const OID_ACCEPTABLE_PRIVILEGE_POLICIES = '2.5.29.57';
76
-    const OID_TO_BE_REVOKED = '2.5.29.58';
77
-    const OID_REVOKED_GROUPS = '2.5.29.59';
78
-    const OID_EXPIRED_CERTS_ON_CRL = '2.5.29.60';
79
-    const OID_INDIRECT_ISSUER = '2.5.29.61';
80
-    const OID_NO_ASSERTION = '2.5.29.62';
81
-    const OID_AA_ISSUING_DISTRIBUTION_POINT = '2.5.29.63';
82
-    const OID_ISSUED_ON_BEHALF_OF = '2.5.29.64';
83
-    const OID_SINGLE_USE = '2.5.29.65';
84
-    const OID_GROUP_AC = '2.5.29.66';
85
-    const OID_ALLOWED_ATT_ASS = '2.5.29.67';
86
-    const OID_ATTRIBUTE_MAPPINGS = '2.5.29.68';
87
-    const OID_HOLDER_NAME_CONSTRAINTS = '2.5.29.69';
21
+	// OID's from standard certificate extensions
22
+	const OID_OBSOLETE_AUTHORITY_KEY_IDENTIFIER = '2.5.29.1';
23
+	const OID_OBSOLETE_KEY_ATTRIBUTES = '2.5.29.2';
24
+	const OID_OBSOLETE_CERTIFICATE_POLICIES = '2.5.29.3';
25
+	const OID_OBSOLETE_KEY_USAGE_RESTRICTION = '2.5.29.4';
26
+	const OID_OBSOLETE_POLICY_MAPPING = '2.5.29.5';
27
+	const OID_OBSOLETE_SUBTREES_CONSTRAINT = '2.5.29.6';
28
+	const OID_OBSOLETE_SUBJECT_ALT_NAME = '2.5.29.7';
29
+	const OID_OBSOLETE_ISSUER_ALT_NAME = '2.5.29.8';
30
+	const OID_SUBJECT_DIRECTORY_ATTRIBUTES = '2.5.29.9';
31
+	const OID_OBSOLETE_BASIC_CONSTRAINTS = '2.5.29.10';
32
+	const OID_SUBJECT_KEY_IDENTIFIER = '2.5.29.14';
33
+	const OID_KEY_USAGE = '2.5.29.15';
34
+	const OID_PRIVATE_KEY_USAGE_PERIOD = '2.5.29.16';
35
+	const OID_SUBJECT_ALT_NAME = '2.5.29.17';
36
+	const OID_ISSUER_ALT_NAME = '2.5.29.18';
37
+	const OID_BASIC_CONSTRAINTS = '2.5.29.19';
38
+	const OID_CRL_NUMBER = '2.5.29.20';
39
+	const OID_REASON_CODE = '2.5.29.21';
40
+	const OID_OBSOLETE_EXPIRATION_DATE = '2.5.29.22';
41
+	const OID_INSTRUCTION_CODE = '2.5.29.23';
42
+	const OID_INVALIDITY_DATE = '2.5.29.24';
43
+	const OID_OBSOLETE_CRL_DISTRIBUTION_POINTS = '2.5.29.25';
44
+	const OID_OBSOLETE_ISSUING_DISTRIBUTION_POINT = '2.5.29.26';
45
+	const OID_DELTA_CRL_INDICATOR = '2.5.29.27';
46
+	const OID_ISSUING_DISTRIBUTION_POINT = '2.5.29.28';
47
+	const OID_CERTIFICATE_ISSUER = '2.5.29.29';
48
+	const OID_NAME_CONSTRAINTS = '2.5.29.30';
49
+	const OID_CRL_DISTRIBUTION_POINTS = '2.5.29.31';
50
+	const OID_CERTIFICATE_POLICIES = '2.5.29.32';
51
+	const OID_POLICY_MAPPINGS = '2.5.29.33';
52
+	const OID_OBSOLETE_POLICY_CONSTRAINTS = '2.5.29.34';
53
+	const OID_AUTHORITY_KEY_IDENTIFIER = '2.5.29.35';
54
+	const OID_POLICY_CONSTRAINTS = '2.5.29.36';
55
+	const OID_EXT_KEY_USAGE = '2.5.29.37';
56
+	const OID_AUTHORITY_ATTRIBUTE_IDENTIFIER = '2.5.29.38';
57
+	const OID_ROLE_SPEC_CERT_IDENTIFIER = '2.5.29.39';
58
+	const OID_CRL_STREAM_IDENTIFIER = '2.5.29.40';
59
+	const OID_BASIC_ATT_CONSTRAINTS = '2.5.29.41';
60
+	const OID_DELEGATED_NAME_CONSTRAINTS = '2.5.29.42';
61
+	const OID_TIME_SPECIFICATION = '2.5.29.43';
62
+	const OID_CRL_SCOPE = '2.5.29.44';
63
+	const OID_STATUS_REFERRALS = '2.5.29.45';
64
+	const OID_FRESHEST_CRL = '2.5.29.46';
65
+	const OID_ORDERED_LIST = '2.5.29.47';
66
+	const OID_ATTRIBUTE_DESCRIPTOR = '2.5.29.48';
67
+	const OID_USER_NOTICE = '2.5.29.49';
68
+	const OID_SOA_IDENTIFIER = '2.5.29.50';
69
+	const OID_BASE_UPDATE_TIME = '2.5.29.51';
70
+	const OID_ACCEPTABLE_CERT_POLICIES = '2.5.29.52';
71
+	const OID_DELTA_INFO = '2.5.29.53';
72
+	const OID_INHIBIT_ANY_POLICY = '2.5.29.54';
73
+	const OID_TARGET_INFORMATION = '2.5.29.55';
74
+	const OID_NO_REV_AVAIL = '2.5.29.56';
75
+	const OID_ACCEPTABLE_PRIVILEGE_POLICIES = '2.5.29.57';
76
+	const OID_TO_BE_REVOKED = '2.5.29.58';
77
+	const OID_REVOKED_GROUPS = '2.5.29.59';
78
+	const OID_EXPIRED_CERTS_ON_CRL = '2.5.29.60';
79
+	const OID_INDIRECT_ISSUER = '2.5.29.61';
80
+	const OID_NO_ASSERTION = '2.5.29.62';
81
+	const OID_AA_ISSUING_DISTRIBUTION_POINT = '2.5.29.63';
82
+	const OID_ISSUED_ON_BEHALF_OF = '2.5.29.64';
83
+	const OID_SINGLE_USE = '2.5.29.65';
84
+	const OID_GROUP_AC = '2.5.29.66';
85
+	const OID_ALLOWED_ATT_ASS = '2.5.29.67';
86
+	const OID_ATTRIBUTE_MAPPINGS = '2.5.29.68';
87
+	const OID_HOLDER_NAME_CONSTRAINTS = '2.5.29.69';
88 88
 
89
-    // OID's from private certificate extensions arc
90
-    const OID_AUTHORITY_INFORMATION_ACCESS = '1.3.6.1.5.5.7.1.1';
91
-    const OID_AA_CONTROLS = '1.3.6.1.5.5.7.1.6';
92
-    const OID_SUBJECT_INFORMATION_ACCESS = '1.3.6.1.5.5.7.1.11';
93
-    const OID_LOGOTYPE = '1.3.6.1.5.5.7.1.12';
89
+	// OID's from private certificate extensions arc
90
+	const OID_AUTHORITY_INFORMATION_ACCESS = '1.3.6.1.5.5.7.1.1';
91
+	const OID_AA_CONTROLS = '1.3.6.1.5.5.7.1.6';
92
+	const OID_SUBJECT_INFORMATION_ACCESS = '1.3.6.1.5.5.7.1.11';
93
+	const OID_LOGOTYPE = '1.3.6.1.5.5.7.1.12';
94 94
 
95
-    /**
96
-     * Mapping from extension ID to implementation class name.
97
-     *
98
-     * @internal
99
-     *
100
-     * @var array
101
-     */
102
-    const MAP_OID_TO_CLASS = [
103
-        self::OID_AUTHORITY_KEY_IDENTIFIER => AuthorityKeyIdentifierExtension::class,
104
-        self::OID_SUBJECT_KEY_IDENTIFIER => SubjectKeyIdentifierExtension::class,
105
-        self::OID_KEY_USAGE => KeyUsageExtension::class,
106
-        self::OID_CERTIFICATE_POLICIES => CertificatePoliciesExtension::class,
107
-        self::OID_POLICY_MAPPINGS => PolicyMappingsExtension::class,
108
-        self::OID_SUBJECT_ALT_NAME => SubjectAlternativeNameExtension::class,
109
-        self::OID_ISSUER_ALT_NAME => IssuerAlternativeNameExtension::class,
110
-        self::OID_SUBJECT_DIRECTORY_ATTRIBUTES => SubjectDirectoryAttributesExtension::class,
111
-        self::OID_BASIC_CONSTRAINTS => BasicConstraintsExtension::class,
112
-        self::OID_NAME_CONSTRAINTS => NameConstraintsExtension::class,
113
-        self::OID_POLICY_CONSTRAINTS => PolicyConstraintsExtension::class,
114
-        self::OID_EXT_KEY_USAGE => ExtendedKeyUsageExtension::class,
115
-        self::OID_CRL_DISTRIBUTION_POINTS => CRLDistributionPointsExtension::class,
116
-        self::OID_INHIBIT_ANY_POLICY => InhibitAnyPolicyExtension::class,
117
-        self::OID_FRESHEST_CRL => FreshestCRLExtension::class,
118
-        self::OID_NO_REV_AVAIL => NoRevocationAvailableExtension::class,
119
-        self::OID_TARGET_INFORMATION => TargetInformationExtension::class,
120
-        self::OID_AUTHORITY_INFORMATION_ACCESS => AuthorityInformationAccessExtension::class,
121
-        self::OID_AA_CONTROLS => AAControlsExtension::class,
122
-        self::OID_SUBJECT_INFORMATION_ACCESS => SubjectInformationAccessExtension::class,
123
-    ];
95
+	/**
96
+	 * Mapping from extension ID to implementation class name.
97
+	 *
98
+	 * @internal
99
+	 *
100
+	 * @var array
101
+	 */
102
+	const MAP_OID_TO_CLASS = [
103
+		self::OID_AUTHORITY_KEY_IDENTIFIER => AuthorityKeyIdentifierExtension::class,
104
+		self::OID_SUBJECT_KEY_IDENTIFIER => SubjectKeyIdentifierExtension::class,
105
+		self::OID_KEY_USAGE => KeyUsageExtension::class,
106
+		self::OID_CERTIFICATE_POLICIES => CertificatePoliciesExtension::class,
107
+		self::OID_POLICY_MAPPINGS => PolicyMappingsExtension::class,
108
+		self::OID_SUBJECT_ALT_NAME => SubjectAlternativeNameExtension::class,
109
+		self::OID_ISSUER_ALT_NAME => IssuerAlternativeNameExtension::class,
110
+		self::OID_SUBJECT_DIRECTORY_ATTRIBUTES => SubjectDirectoryAttributesExtension::class,
111
+		self::OID_BASIC_CONSTRAINTS => BasicConstraintsExtension::class,
112
+		self::OID_NAME_CONSTRAINTS => NameConstraintsExtension::class,
113
+		self::OID_POLICY_CONSTRAINTS => PolicyConstraintsExtension::class,
114
+		self::OID_EXT_KEY_USAGE => ExtendedKeyUsageExtension::class,
115
+		self::OID_CRL_DISTRIBUTION_POINTS => CRLDistributionPointsExtension::class,
116
+		self::OID_INHIBIT_ANY_POLICY => InhibitAnyPolicyExtension::class,
117
+		self::OID_FRESHEST_CRL => FreshestCRLExtension::class,
118
+		self::OID_NO_REV_AVAIL => NoRevocationAvailableExtension::class,
119
+		self::OID_TARGET_INFORMATION => TargetInformationExtension::class,
120
+		self::OID_AUTHORITY_INFORMATION_ACCESS => AuthorityInformationAccessExtension::class,
121
+		self::OID_AA_CONTROLS => AAControlsExtension::class,
122
+		self::OID_SUBJECT_INFORMATION_ACCESS => SubjectInformationAccessExtension::class,
123
+	];
124 124
 
125
-    /**
126
-     * Mapping from extensions ID to short name.
127
-     *
128
-     * @internal
129
-     *
130
-     * @var array
131
-     */
132
-    const MAP_OID_TO_NAME = [
133
-        self::OID_AUTHORITY_KEY_IDENTIFIER => 'authorityKeyIdentifier',
134
-        self::OID_SUBJECT_KEY_IDENTIFIER => 'subjectKeyIdentifier',
135
-        self::OID_KEY_USAGE => 'keyUsage',
136
-        self::OID_PRIVATE_KEY_USAGE_PERIOD => 'privateKeyUsagePeriod',
137
-        self::OID_CERTIFICATE_POLICIES => 'certificatePolicies',
138
-        self::OID_POLICY_MAPPINGS => 'policyMappings',
139
-        self::OID_SUBJECT_ALT_NAME => 'subjectAltName',
140
-        self::OID_ISSUER_ALT_NAME => 'issuerAltName',
141
-        self::OID_SUBJECT_DIRECTORY_ATTRIBUTES => 'subjectDirectoryAttributes',
142
-        self::OID_BASIC_CONSTRAINTS => 'basicConstraints',
143
-        self::OID_NAME_CONSTRAINTS => 'nameConstraints',
144
-        self::OID_POLICY_CONSTRAINTS => 'policyConstraints',
145
-        self::OID_EXT_KEY_USAGE => 'extKeyUsage',
146
-        self::OID_CRL_DISTRIBUTION_POINTS => 'cRLDistributionPoints',
147
-        self::OID_INHIBIT_ANY_POLICY => 'inhibitAnyPolicy',
148
-        self::OID_FRESHEST_CRL => 'freshestCRL',
149
-        self::OID_NO_REV_AVAIL => 'noRevAvail',
150
-        self::OID_TARGET_INFORMATION => 'targetInformation',
151
-        self::OID_AUTHORITY_INFORMATION_ACCESS => 'authorityInfoAccess',
152
-        self::OID_AA_CONTROLS => 'aaControls',
153
-        self::OID_SUBJECT_INFORMATION_ACCESS => 'subjectInfoAccess',
154
-        self::OID_LOGOTYPE => 'logotype',
155
-    ];
125
+	/**
126
+	 * Mapping from extensions ID to short name.
127
+	 *
128
+	 * @internal
129
+	 *
130
+	 * @var array
131
+	 */
132
+	const MAP_OID_TO_NAME = [
133
+		self::OID_AUTHORITY_KEY_IDENTIFIER => 'authorityKeyIdentifier',
134
+		self::OID_SUBJECT_KEY_IDENTIFIER => 'subjectKeyIdentifier',
135
+		self::OID_KEY_USAGE => 'keyUsage',
136
+		self::OID_PRIVATE_KEY_USAGE_PERIOD => 'privateKeyUsagePeriod',
137
+		self::OID_CERTIFICATE_POLICIES => 'certificatePolicies',
138
+		self::OID_POLICY_MAPPINGS => 'policyMappings',
139
+		self::OID_SUBJECT_ALT_NAME => 'subjectAltName',
140
+		self::OID_ISSUER_ALT_NAME => 'issuerAltName',
141
+		self::OID_SUBJECT_DIRECTORY_ATTRIBUTES => 'subjectDirectoryAttributes',
142
+		self::OID_BASIC_CONSTRAINTS => 'basicConstraints',
143
+		self::OID_NAME_CONSTRAINTS => 'nameConstraints',
144
+		self::OID_POLICY_CONSTRAINTS => 'policyConstraints',
145
+		self::OID_EXT_KEY_USAGE => 'extKeyUsage',
146
+		self::OID_CRL_DISTRIBUTION_POINTS => 'cRLDistributionPoints',
147
+		self::OID_INHIBIT_ANY_POLICY => 'inhibitAnyPolicy',
148
+		self::OID_FRESHEST_CRL => 'freshestCRL',
149
+		self::OID_NO_REV_AVAIL => 'noRevAvail',
150
+		self::OID_TARGET_INFORMATION => 'targetInformation',
151
+		self::OID_AUTHORITY_INFORMATION_ACCESS => 'authorityInfoAccess',
152
+		self::OID_AA_CONTROLS => 'aaControls',
153
+		self::OID_SUBJECT_INFORMATION_ACCESS => 'subjectInfoAccess',
154
+		self::OID_LOGOTYPE => 'logotype',
155
+	];
156 156
 
157
-    /**
158
-     * Extension's OID.
159
-     *
160
-     * @var string
161
-     */
162
-    protected $_oid;
157
+	/**
158
+	 * Extension's OID.
159
+	 *
160
+	 * @var string
161
+	 */
162
+	protected $_oid;
163 163
 
164
-    /**
165
-     * Whether extension is critical.
166
-     *
167
-     * @var bool
168
-     */
169
-    protected $_critical;
164
+	/**
165
+	 * Whether extension is critical.
166
+	 *
167
+	 * @var bool
168
+	 */
169
+	protected $_critical;
170 170
 
171
-    /**
172
-     * Constructor.
173
-     *
174
-     * @param string $oid      Extension OID
175
-     * @param bool   $critical Whether extension is critical
176
-     */
177
-    public function __construct(string $oid, bool $critical)
178
-    {
179
-        $this->_oid = $oid;
180
-        $this->_critical = $critical;
181
-    }
171
+	/**
172
+	 * Constructor.
173
+	 *
174
+	 * @param string $oid      Extension OID
175
+	 * @param bool   $critical Whether extension is critical
176
+	 */
177
+	public function __construct(string $oid, bool $critical)
178
+	{
179
+		$this->_oid = $oid;
180
+		$this->_critical = $critical;
181
+	}
182 182
 
183
-    /**
184
-     * @return string
185
-     */
186
-    public function __toString(): string
187
-    {
188
-        return $this->extensionName();
189
-    }
183
+	/**
184
+	 * @return string
185
+	 */
186
+	public function __toString(): string
187
+	{
188
+		return $this->extensionName();
189
+	}
190 190
 
191
-    /**
192
-     * Initialize from ASN.1.
193
-     *
194
-     * @param Sequence $seq
195
-     *
196
-     * @return self
197
-     */
198
-    public static function fromASN1(Sequence $seq): Extension
199
-    {
200
-        $idx = 0;
201
-        $extnID = $seq->at($idx++)->asObjectIdentifier()->oid();
202
-        $critical = false;
203
-        if ($seq->has($idx, Element::TYPE_BOOLEAN)) {
204
-            $critical = $seq->at($idx++)->asBoolean()->value();
205
-        }
206
-        $data = $seq->at($idx)->asOctetString()->string();
207
-        if (array_key_exists($extnID, self::MAP_OID_TO_CLASS)) {
208
-            $cls = self::MAP_OID_TO_CLASS[$extnID];
209
-            return $cls::_fromDER($data, $critical);
210
-        }
211
-        return UnknownExtension::fromRawString($extnID, $critical, $data);
212
-    }
191
+	/**
192
+	 * Initialize from ASN.1.
193
+	 *
194
+	 * @param Sequence $seq
195
+	 *
196
+	 * @return self
197
+	 */
198
+	public static function fromASN1(Sequence $seq): Extension
199
+	{
200
+		$idx = 0;
201
+		$extnID = $seq->at($idx++)->asObjectIdentifier()->oid();
202
+		$critical = false;
203
+		if ($seq->has($idx, Element::TYPE_BOOLEAN)) {
204
+			$critical = $seq->at($idx++)->asBoolean()->value();
205
+		}
206
+		$data = $seq->at($idx)->asOctetString()->string();
207
+		if (array_key_exists($extnID, self::MAP_OID_TO_CLASS)) {
208
+			$cls = self::MAP_OID_TO_CLASS[$extnID];
209
+			return $cls::_fromDER($data, $critical);
210
+		}
211
+		return UnknownExtension::fromRawString($extnID, $critical, $data);
212
+	}
213 213
 
214
-    /**
215
-     * Get extension OID.
216
-     *
217
-     * @return string
218
-     */
219
-    public function oid(): string
220
-    {
221
-        return $this->_oid;
222
-    }
214
+	/**
215
+	 * Get extension OID.
216
+	 *
217
+	 * @return string
218
+	 */
219
+	public function oid(): string
220
+	{
221
+		return $this->_oid;
222
+	}
223 223
 
224
-    /**
225
-     * Check whether extension is critical.
226
-     *
227
-     * @return bool
228
-     */
229
-    public function isCritical(): bool
230
-    {
231
-        return $this->_critical;
232
-    }
224
+	/**
225
+	 * Check whether extension is critical.
226
+	 *
227
+	 * @return bool
228
+	 */
229
+	public function isCritical(): bool
230
+	{
231
+		return $this->_critical;
232
+	}
233 233
 
234
-    /**
235
-     * Generate ASN.1 structure.
236
-     *
237
-     * @return Sequence
238
-     */
239
-    public function toASN1(): Sequence
240
-    {
241
-        $elements = [new ObjectIdentifier($this->_oid)];
242
-        if ($this->_critical) {
243
-            $elements[] = new Boolean(true);
244
-        }
245
-        $elements[] = $this->_extnValue();
246
-        return new Sequence(...$elements);
247
-    }
234
+	/**
235
+	 * Generate ASN.1 structure.
236
+	 *
237
+	 * @return Sequence
238
+	 */
239
+	public function toASN1(): Sequence
240
+	{
241
+		$elements = [new ObjectIdentifier($this->_oid)];
242
+		if ($this->_critical) {
243
+			$elements[] = new Boolean(true);
244
+		}
245
+		$elements[] = $this->_extnValue();
246
+		return new Sequence(...$elements);
247
+	}
248 248
 
249
-    /**
250
-     * Get short name of the extension.
251
-     *
252
-     * @return string
253
-     */
254
-    public function extensionName(): string
255
-    {
256
-        if (array_key_exists($this->_oid, self::MAP_OID_TO_NAME)) {
257
-            return self::MAP_OID_TO_NAME[$this->_oid];
258
-        }
259
-        return $this->oid();
260
-    }
249
+	/**
250
+	 * Get short name of the extension.
251
+	 *
252
+	 * @return string
253
+	 */
254
+	public function extensionName(): string
255
+	{
256
+		if (array_key_exists($this->_oid, self::MAP_OID_TO_NAME)) {
257
+			return self::MAP_OID_TO_NAME[$this->_oid];
258
+		}
259
+		return $this->oid();
260
+	}
261 261
 
262
-    /**
263
-     * Get ASN.1 structure of the extension value.
264
-     *
265
-     * @return Element
266
-     */
267
-    abstract protected function _valueASN1(): Element;
262
+	/**
263
+	 * Get ASN.1 structure of the extension value.
264
+	 *
265
+	 * @return Element
266
+	 */
267
+	abstract protected function _valueASN1(): Element;
268 268
 
269
-    /**
270
-     * Parse extension value from DER.
271
-     *
272
-     * @param string $data     DER data
273
-     * @param bool   $critical Whether extension is critical
274
-     *
275
-     * @throws \BadMethodCallException
276
-     *
277
-     * @return self
278
-     */
279
-    protected static function _fromDER(string $data, bool $critical): Extension
280
-    {
281
-        throw new \BadMethodCallException(
282
-            __FUNCTION__ . ' must be implemented in derived class.');
283
-    }
269
+	/**
270
+	 * Parse extension value from DER.
271
+	 *
272
+	 * @param string $data     DER data
273
+	 * @param bool   $critical Whether extension is critical
274
+	 *
275
+	 * @throws \BadMethodCallException
276
+	 *
277
+	 * @return self
278
+	 */
279
+	protected static function _fromDER(string $data, bool $critical): Extension
280
+	{
281
+		throw new \BadMethodCallException(
282
+			__FUNCTION__ . ' must be implemented in derived class.');
283
+	}
284 284
 
285
-    /**
286
-     * Get the extnValue element.
287
-     *
288
-     * @return OctetString
289
-     */
290
-    protected function _extnValue(): OctetString
291
-    {
292
-        return new OctetString($this->_valueASN1()->toDER());
293
-    }
285
+	/**
286
+	 * Get the extnValue element.
287
+	 *
288
+	 * @return OctetString
289
+	 */
290
+	protected function _extnValue(): OctetString
291
+	{
292
+		return new OctetString($this->_valueASN1()->toDER());
293
+	}
294 294
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/CRLDistributionPointsExtension.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -16,89 +16,89 @@
 block discarded – undo
16 16
  */
17 17
 class CRLDistributionPointsExtension extends Extension implements \Countable, \IteratorAggregate
18 18
 {
19
-    /**
20
-     * Distribution points.
21
-     *
22
-     * @var DistributionPoint[]
23
-     */
24
-    protected $_distributionPoints;
19
+	/**
20
+	 * Distribution points.
21
+	 *
22
+	 * @var DistributionPoint[]
23
+	 */
24
+	protected $_distributionPoints;
25 25
 
26
-    /**
27
-     * Constructor.
28
-     *
29
-     * @param bool              $critical
30
-     * @param DistributionPoint ...$distribution_points
31
-     */
32
-    public function __construct(bool $critical,
33
-        DistributionPoint ...$distribution_points)
34
-    {
35
-        parent::__construct(self::OID_CRL_DISTRIBUTION_POINTS, $critical);
36
-        $this->_distributionPoints = $distribution_points;
37
-    }
26
+	/**
27
+	 * Constructor.
28
+	 *
29
+	 * @param bool              $critical
30
+	 * @param DistributionPoint ...$distribution_points
31
+	 */
32
+	public function __construct(bool $critical,
33
+		DistributionPoint ...$distribution_points)
34
+	{
35
+		parent::__construct(self::OID_CRL_DISTRIBUTION_POINTS, $critical);
36
+		$this->_distributionPoints = $distribution_points;
37
+	}
38 38
 
39
-    /**
40
-     * Get distribution points.
41
-     *
42
-     * @return DistributionPoint[]
43
-     */
44
-    public function distributionPoints(): array
45
-    {
46
-        return $this->_distributionPoints;
47
-    }
39
+	/**
40
+	 * Get distribution points.
41
+	 *
42
+	 * @return DistributionPoint[]
43
+	 */
44
+	public function distributionPoints(): array
45
+	{
46
+		return $this->_distributionPoints;
47
+	}
48 48
 
49
-    /**
50
-     * Get the number of distribution points.
51
-     *
52
-     * @see \Countable::count()
53
-     *
54
-     * @return int
55
-     */
56
-    public function count(): int
57
-    {
58
-        return count($this->_distributionPoints);
59
-    }
49
+	/**
50
+	 * Get the number of distribution points.
51
+	 *
52
+	 * @see \Countable::count()
53
+	 *
54
+	 * @return int
55
+	 */
56
+	public function count(): int
57
+	{
58
+		return count($this->_distributionPoints);
59
+	}
60 60
 
61
-    /**
62
-     * Get iterator for distribution points.
63
-     *
64
-     * @see \IteratorAggregate::getIterator()
65
-     *
66
-     * @return \ArrayIterator
67
-     */
68
-    public function getIterator(): \ArrayIterator
69
-    {
70
-        return new \ArrayIterator($this->_distributionPoints);
71
-    }
61
+	/**
62
+	 * Get iterator for distribution points.
63
+	 *
64
+	 * @see \IteratorAggregate::getIterator()
65
+	 *
66
+	 * @return \ArrayIterator
67
+	 */
68
+	public function getIterator(): \ArrayIterator
69
+	{
70
+		return new \ArrayIterator($this->_distributionPoints);
71
+	}
72 72
 
73
-    /**
74
-     * {@inheritdoc}
75
-     */
76
-    protected static function _fromDER(string $data, bool $critical): Extension
77
-    {
78
-        $dps = array_map(
79
-            function (UnspecifiedType $el) {
80
-                return DistributionPoint::fromASN1($el->asSequence());
81
-            }, UnspecifiedType::fromDER($data)->asSequence()->elements());
82
-        if (!count($dps)) {
83
-            throw new \UnexpectedValueException(
84
-                'CRLDistributionPoints must have at least one DistributionPoint.');
85
-        }
86
-        // late static bound, extended by Freshest CRL extension
87
-        return new static($critical, ...$dps);
88
-    }
73
+	/**
74
+	 * {@inheritdoc}
75
+	 */
76
+	protected static function _fromDER(string $data, bool $critical): Extension
77
+	{
78
+		$dps = array_map(
79
+			function (UnspecifiedType $el) {
80
+				return DistributionPoint::fromASN1($el->asSequence());
81
+			}, UnspecifiedType::fromDER($data)->asSequence()->elements());
82
+		if (!count($dps)) {
83
+			throw new \UnexpectedValueException(
84
+				'CRLDistributionPoints must have at least one DistributionPoint.');
85
+		}
86
+		// late static bound, extended by Freshest CRL extension
87
+		return new static($critical, ...$dps);
88
+	}
89 89
 
90
-    /**
91
-     * {@inheritdoc}
92
-     */
93
-    protected function _valueASN1(): Element
94
-    {
95
-        if (!count($this->_distributionPoints)) {
96
-            throw new \LogicException('No distribution points.');
97
-        }
98
-        $elements = array_map(
99
-            function (DistributionPoint $dp) {
100
-                return $dp->toASN1();
101
-            }, $this->_distributionPoints);
102
-        return new Sequence(...$elements);
103
-    }
90
+	/**
91
+	 * {@inheritdoc}
92
+	 */
93
+	protected function _valueASN1(): Element
94
+	{
95
+		if (!count($this->_distributionPoints)) {
96
+			throw new \LogicException('No distribution points.');
97
+		}
98
+		$elements = array_map(
99
+			function (DistributionPoint $dp) {
100
+				return $dp->toASN1();
101
+			}, $this->_distributionPoints);
102
+		return new Sequence(...$elements);
103
+	}
104 104
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/SubjectKeyIdentifierExtension.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -15,49 +15,49 @@
 block discarded – undo
15 15
  */
16 16
 class SubjectKeyIdentifierExtension extends Extension
17 17
 {
18
-    /**
19
-     * Key identifier.
20
-     *
21
-     * @var string
22
-     */
23
-    protected $_keyIdentifier;
24
-
25
-    /**
26
-     * Constructor.
27
-     *
28
-     * @param bool   $critical
29
-     * @param string $keyIdentifier
30
-     */
31
-    public function __construct(bool $critical, string $keyIdentifier)
32
-    {
33
-        parent::__construct(self::OID_SUBJECT_KEY_IDENTIFIER, $critical);
34
-        $this->_keyIdentifier = $keyIdentifier;
35
-    }
36
-
37
-    /**
38
-     * Get key identifier.
39
-     *
40
-     * @return string
41
-     */
42
-    public function keyIdentifier(): string
43
-    {
44
-        return $this->_keyIdentifier;
45
-    }
46
-
47
-    /**
48
-     * {@inheritdoc}
49
-     */
50
-    protected static function _fromDER(string $data, bool $critical): Extension
51
-    {
52
-        return new self($critical,
53
-            UnspecifiedType::fromDER($data)->asOctetString()->string());
54
-    }
55
-
56
-    /**
57
-     * {@inheritdoc}
58
-     */
59
-    protected function _valueASN1(): Element
60
-    {
61
-        return new OctetString($this->_keyIdentifier);
62
-    }
18
+	/**
19
+	 * Key identifier.
20
+	 *
21
+	 * @var string
22
+	 */
23
+	protected $_keyIdentifier;
24
+
25
+	/**
26
+	 * Constructor.
27
+	 *
28
+	 * @param bool   $critical
29
+	 * @param string $keyIdentifier
30
+	 */
31
+	public function __construct(bool $critical, string $keyIdentifier)
32
+	{
33
+		parent::__construct(self::OID_SUBJECT_KEY_IDENTIFIER, $critical);
34
+		$this->_keyIdentifier = $keyIdentifier;
35
+	}
36
+
37
+	/**
38
+	 * Get key identifier.
39
+	 *
40
+	 * @return string
41
+	 */
42
+	public function keyIdentifier(): string
43
+	{
44
+		return $this->_keyIdentifier;
45
+	}
46
+
47
+	/**
48
+	 * {@inheritdoc}
49
+	 */
50
+	protected static function _fromDER(string $data, bool $critical): Extension
51
+	{
52
+		return new self($critical,
53
+			UnspecifiedType::fromDER($data)->asOctetString()->string());
54
+	}
55
+
56
+	/**
57
+	 * {@inheritdoc}
58
+	 */
59
+	protected function _valueASN1(): Element
60
+	{
61
+		return new OctetString($this->_keyIdentifier);
62
+	}
63 63
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/PolicyMappings/PolicyMapping.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -15,74 +15,74 @@
 block discarded – undo
15 15
  */
16 16
 class PolicyMapping
17 17
 {
18
-    /**
19
-     * OID of the issuer policy.
20
-     *
21
-     * @var string
22
-     */
23
-    protected $_issuerDomainPolicy;
18
+	/**
19
+	 * OID of the issuer policy.
20
+	 *
21
+	 * @var string
22
+	 */
23
+	protected $_issuerDomainPolicy;
24 24
 
25
-    /**
26
-     * OID of the subject policy.
27
-     *
28
-     * @var string
29
-     */
30
-    protected $_subjectDomainPolicy;
25
+	/**
26
+	 * OID of the subject policy.
27
+	 *
28
+	 * @var string
29
+	 */
30
+	protected $_subjectDomainPolicy;
31 31
 
32
-    /**
33
-     * Constructor.
34
-     *
35
-     * @param string $issuer_policy  OID of the issuer policy
36
-     * @param string $subject_policy OID of the subject policy
37
-     */
38
-    public function __construct(string $issuer_policy, string $subject_policy)
39
-    {
40
-        $this->_issuerDomainPolicy = $issuer_policy;
41
-        $this->_subjectDomainPolicy = $subject_policy;
42
-    }
32
+	/**
33
+	 * Constructor.
34
+	 *
35
+	 * @param string $issuer_policy  OID of the issuer policy
36
+	 * @param string $subject_policy OID of the subject policy
37
+	 */
38
+	public function __construct(string $issuer_policy, string $subject_policy)
39
+	{
40
+		$this->_issuerDomainPolicy = $issuer_policy;
41
+		$this->_subjectDomainPolicy = $subject_policy;
42
+	}
43 43
 
44
-    /**
45
-     * Initialize from ASN.1.
46
-     *
47
-     * @param Sequence $seq
48
-     *
49
-     * @return self
50
-     */
51
-    public static function fromASN1(Sequence $seq): self
52
-    {
53
-        $issuer_policy = $seq->at(0)->asObjectIdentifier()->oid();
54
-        $subject_policy = $seq->at(1)->asObjectIdentifier()->oid();
55
-        return new self($issuer_policy, $subject_policy);
56
-    }
44
+	/**
45
+	 * Initialize from ASN.1.
46
+	 *
47
+	 * @param Sequence $seq
48
+	 *
49
+	 * @return self
50
+	 */
51
+	public static function fromASN1(Sequence $seq): self
52
+	{
53
+		$issuer_policy = $seq->at(0)->asObjectIdentifier()->oid();
54
+		$subject_policy = $seq->at(1)->asObjectIdentifier()->oid();
55
+		return new self($issuer_policy, $subject_policy);
56
+	}
57 57
 
58
-    /**
59
-     * Get issuer domain policy.
60
-     *
61
-     * @return string OID in dotted format
62
-     */
63
-    public function issuerDomainPolicy(): string
64
-    {
65
-        return $this->_issuerDomainPolicy;
66
-    }
58
+	/**
59
+	 * Get issuer domain policy.
60
+	 *
61
+	 * @return string OID in dotted format
62
+	 */
63
+	public function issuerDomainPolicy(): string
64
+	{
65
+		return $this->_issuerDomainPolicy;
66
+	}
67 67
 
68
-    /**
69
-     * Get subject domain policy.
70
-     *
71
-     * @return string OID in dotted format
72
-     */
73
-    public function subjectDomainPolicy(): string
74
-    {
75
-        return $this->_subjectDomainPolicy;
76
-    }
68
+	/**
69
+	 * Get subject domain policy.
70
+	 *
71
+	 * @return string OID in dotted format
72
+	 */
73
+	public function subjectDomainPolicy(): string
74
+	{
75
+		return $this->_subjectDomainPolicy;
76
+	}
77 77
 
78
-    /**
79
-     * Generate ASN.1 structure.
80
-     *
81
-     * @return Sequence
82
-     */
83
-    public function toASN1(): Sequence
84
-    {
85
-        return new Sequence(new ObjectIdentifier($this->_issuerDomainPolicy),
86
-            new ObjectIdentifier($this->_subjectDomainPolicy));
87
-    }
78
+	/**
79
+	 * Generate ASN.1 structure.
80
+	 *
81
+	 * @return Sequence
82
+	 */
83
+	public function toASN1(): Sequence
84
+	{
85
+		return new Sequence(new ObjectIdentifier($this->_issuerDomainPolicy),
86
+			new ObjectIdentifier($this->_subjectDomainPolicy));
87
+	}
88 88
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/NameConstraints/GeneralSubtree.php 1 patch
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -18,88 +18,88 @@
 block discarded – undo
18 18
  */
19 19
 class GeneralSubtree
20 20
 {
21
-    /**
22
-     * Constraint.
23
-     *
24
-     * @var GeneralName
25
-     */
26
-    protected $_base;
21
+	/**
22
+	 * Constraint.
23
+	 *
24
+	 * @var GeneralName
25
+	 */
26
+	protected $_base;
27 27
 
28
-    /**
29
-     * Not used, must be zero.
30
-     *
31
-     * @var int
32
-     */
33
-    protected $_min;
28
+	/**
29
+	 * Not used, must be zero.
30
+	 *
31
+	 * @var int
32
+	 */
33
+	protected $_min;
34 34
 
35
-    /**
36
-     * Not used, must be null.
37
-     *
38
-     * @var null|int
39
-     */
40
-    protected $_max;
35
+	/**
36
+	 * Not used, must be null.
37
+	 *
38
+	 * @var null|int
39
+	 */
40
+	protected $_max;
41 41
 
42
-    /**
43
-     * Constructor.
44
-     *
45
-     * @param GeneralName $base
46
-     * @param int         $min
47
-     * @param null|int    $max
48
-     */
49
-    public function __construct(GeneralName $base, int $min = 0, ?int $max = null)
50
-    {
51
-        $this->_base = $base;
52
-        $this->_min = $min;
53
-        $this->_max = $max;
54
-    }
42
+	/**
43
+	 * Constructor.
44
+	 *
45
+	 * @param GeneralName $base
46
+	 * @param int         $min
47
+	 * @param null|int    $max
48
+	 */
49
+	public function __construct(GeneralName $base, int $min = 0, ?int $max = null)
50
+	{
51
+		$this->_base = $base;
52
+		$this->_min = $min;
53
+		$this->_max = $max;
54
+	}
55 55
 
56
-    /**
57
-     * Initialize from ASN.1.
58
-     *
59
-     * @param Sequence $seq
60
-     *
61
-     * @return self
62
-     */
63
-    public static function fromASN1(Sequence $seq): self
64
-    {
65
-        $base = GeneralName::fromASN1($seq->at(0)->asTagged());
66
-        $min = 0;
67
-        $max = null;
68
-        if ($seq->hasTagged(0)) {
69
-            $min = $seq->getTagged(0)->asImplicit(Element::TYPE_INTEGER)
70
-                ->asInteger()->intNumber();
71
-        }
72
-        if ($seq->hasTagged(1)) {
73
-            $max = $seq->getTagged(1)->asImplicit(Element::TYPE_INTEGER)
74
-                ->asInteger()->intNumber();
75
-        }
76
-        return new self($base, $min, $max);
77
-    }
56
+	/**
57
+	 * Initialize from ASN.1.
58
+	 *
59
+	 * @param Sequence $seq
60
+	 *
61
+	 * @return self
62
+	 */
63
+	public static function fromASN1(Sequence $seq): self
64
+	{
65
+		$base = GeneralName::fromASN1($seq->at(0)->asTagged());
66
+		$min = 0;
67
+		$max = null;
68
+		if ($seq->hasTagged(0)) {
69
+			$min = $seq->getTagged(0)->asImplicit(Element::TYPE_INTEGER)
70
+				->asInteger()->intNumber();
71
+		}
72
+		if ($seq->hasTagged(1)) {
73
+			$max = $seq->getTagged(1)->asImplicit(Element::TYPE_INTEGER)
74
+				->asInteger()->intNumber();
75
+		}
76
+		return new self($base, $min, $max);
77
+	}
78 78
 
79
-    /**
80
-     * Get constraint.
81
-     *
82
-     * @return GeneralName
83
-     */
84
-    public function base(): GeneralName
85
-    {
86
-        return $this->_base;
87
-    }
79
+	/**
80
+	 * Get constraint.
81
+	 *
82
+	 * @return GeneralName
83
+	 */
84
+	public function base(): GeneralName
85
+	{
86
+		return $this->_base;
87
+	}
88 88
 
89
-    /**
90
-     * Generate ASN.1 structure.
91
-     *
92
-     * @return Sequence
93
-     */
94
-    public function toASN1(): Sequence
95
-    {
96
-        $elements = [$this->_base->toASN1()];
97
-        if (isset($this->_min) && 0 !== $this->_min) {
98
-            $elements[] = new ImplicitlyTaggedType(0, new Integer($this->_min));
99
-        }
100
-        if (isset($this->_max)) {
101
-            $elements[] = new ImplicitlyTaggedType(1, new Integer($this->_max));
102
-        }
103
-        return new Sequence(...$elements);
104
-    }
89
+	/**
90
+	 * Generate ASN.1 structure.
91
+	 *
92
+	 * @return Sequence
93
+	 */
94
+	public function toASN1(): Sequence
95
+	{
96
+		$elements = [$this->_base->toASN1()];
97
+		if (isset($this->_min) && 0 !== $this->_min) {
98
+			$elements[] = new ImplicitlyTaggedType(0, new Integer($this->_min));
99
+		}
100
+		if (isset($this->_max)) {
101
+			$elements[] = new ImplicitlyTaggedType(1, new Integer($this->_max));
102
+		}
103
+		return new Sequence(...$elements);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/NameConstraints/GeneralSubtrees.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -15,89 +15,89 @@
 block discarded – undo
15 15
  */
16 16
 class GeneralSubtrees implements \Countable, \IteratorAggregate
17 17
 {
18
-    /**
19
-     * Subtrees.
20
-     *
21
-     * @var GeneralSubtree[]
22
-     */
23
-    protected $_subtrees;
18
+	/**
19
+	 * Subtrees.
20
+	 *
21
+	 * @var GeneralSubtree[]
22
+	 */
23
+	protected $_subtrees;
24 24
 
25
-    /**
26
-     * Constructor.
27
-     *
28
-     * @param GeneralSubtree ...$subtrees
29
-     */
30
-    public function __construct(GeneralSubtree ...$subtrees)
31
-    {
32
-        $this->_subtrees = $subtrees;
33
-    }
25
+	/**
26
+	 * Constructor.
27
+	 *
28
+	 * @param GeneralSubtree ...$subtrees
29
+	 */
30
+	public function __construct(GeneralSubtree ...$subtrees)
31
+	{
32
+		$this->_subtrees = $subtrees;
33
+	}
34 34
 
35
-    /**
36
-     * Initialize from ASN.1.
37
-     *
38
-     * @param Sequence $seq
39
-     *
40
-     * @return self
41
-     */
42
-    public static function fromASN1(Sequence $seq): self
43
-    {
44
-        $subtrees = array_map(
45
-            function (UnspecifiedType $el) {
46
-                return GeneralSubtree::fromASN1($el->asSequence());
47
-            }, $seq->elements());
48
-        if (!count($subtrees)) {
49
-            throw new \UnexpectedValueException(
50
-                'GeneralSubtrees must contain at least one GeneralSubtree.');
51
-        }
52
-        return new self(...$subtrees);
53
-    }
35
+	/**
36
+	 * Initialize from ASN.1.
37
+	 *
38
+	 * @param Sequence $seq
39
+	 *
40
+	 * @return self
41
+	 */
42
+	public static function fromASN1(Sequence $seq): self
43
+	{
44
+		$subtrees = array_map(
45
+			function (UnspecifiedType $el) {
46
+				return GeneralSubtree::fromASN1($el->asSequence());
47
+			}, $seq->elements());
48
+		if (!count($subtrees)) {
49
+			throw new \UnexpectedValueException(
50
+				'GeneralSubtrees must contain at least one GeneralSubtree.');
51
+		}
52
+		return new self(...$subtrees);
53
+	}
54 54
 
55
-    /**
56
-     * Get all subtrees.
57
-     *
58
-     * @return GeneralSubtree[]
59
-     */
60
-    public function all(): array
61
-    {
62
-        return $this->_subtrees;
63
-    }
55
+	/**
56
+	 * Get all subtrees.
57
+	 *
58
+	 * @return GeneralSubtree[]
59
+	 */
60
+	public function all(): array
61
+	{
62
+		return $this->_subtrees;
63
+	}
64 64
 
65
-    /**
66
-     * Generate ASN.1 structure.
67
-     *
68
-     * @return Sequence
69
-     */
70
-    public function toASN1(): Sequence
71
-    {
72
-        if (!count($this->_subtrees)) {
73
-            throw new \LogicException('No subtrees.');
74
-        }
75
-        $elements = array_map(
76
-            function (GeneralSubtree $gs) {
77
-                return $gs->toASN1();
78
-            }, $this->_subtrees);
79
-        return new Sequence(...$elements);
80
-    }
65
+	/**
66
+	 * Generate ASN.1 structure.
67
+	 *
68
+	 * @return Sequence
69
+	 */
70
+	public function toASN1(): Sequence
71
+	{
72
+		if (!count($this->_subtrees)) {
73
+			throw new \LogicException('No subtrees.');
74
+		}
75
+		$elements = array_map(
76
+			function (GeneralSubtree $gs) {
77
+				return $gs->toASN1();
78
+			}, $this->_subtrees);
79
+		return new Sequence(...$elements);
80
+	}
81 81
 
82
-    /**
83
-     * @see \Countable::count()
84
-     *
85
-     * @return int
86
-     */
87
-    public function count(): int
88
-    {
89
-        return count($this->_subtrees);
90
-    }
82
+	/**
83
+	 * @see \Countable::count()
84
+	 *
85
+	 * @return int
86
+	 */
87
+	public function count(): int
88
+	{
89
+		return count($this->_subtrees);
90
+	}
91 91
 
92
-    /**
93
-     * Get iterator for subtrees.
94
-     *
95
-     * @see \IteratorAggregate::getIterator()
96
-     *
97
-     * @return \ArrayIterator
98
-     */
99
-    public function getIterator(): \ArrayIterator
100
-    {
101
-        return new \ArrayIterator($this->_subtrees);
102
-    }
92
+	/**
93
+	 * Get iterator for subtrees.
94
+	 *
95
+	 * @see \IteratorAggregate::getIterator()
96
+	 *
97
+	 * @return \ArrayIterator
98
+	 */
99
+	public function getIterator(): \ArrayIterator
100
+	{
101
+		return new \ArrayIterator($this->_subtrees);
102
+	}
103 103
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/UnknownExtension.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -12,78 +12,78 @@
 block discarded – undo
12 12
  */
13 13
 class UnknownExtension extends Extension
14 14
 {
15
-    /**
16
-     * Decoded extension value.
17
-     *
18
-     * @var null|Element
19
-     */
20
-    protected $_element;
15
+	/**
16
+	 * Decoded extension value.
17
+	 *
18
+	 * @var null|Element
19
+	 */
20
+	protected $_element;
21 21
 
22
-    /**
23
-     * Raw extension value.
24
-     *
25
-     * @var string
26
-     */
27
-    protected $_data;
22
+	/**
23
+	 * Raw extension value.
24
+	 *
25
+	 * @var string
26
+	 */
27
+	protected $_data;
28 28
 
29
-    /**
30
-     * Constructor.
31
-     *
32
-     * @param string  $oid
33
-     * @param bool    $critical
34
-     * @param Element $element
35
-     */
36
-    public function __construct(string $oid, bool $critical, Element $element)
37
-    {
38
-        parent::__construct($oid, $critical);
39
-        $this->_element = $element;
40
-        $this->_data = $element->toDER();
41
-    }
29
+	/**
30
+	 * Constructor.
31
+	 *
32
+	 * @param string  $oid
33
+	 * @param bool    $critical
34
+	 * @param Element $element
35
+	 */
36
+	public function __construct(string $oid, bool $critical, Element $element)
37
+	{
38
+		parent::__construct($oid, $critical);
39
+		$this->_element = $element;
40
+		$this->_data = $element->toDER();
41
+	}
42 42
 
43
-    /**
44
-     * Create instance from a raw encoded extension value.
45
-     *
46
-     * @param string $oid
47
-     * @param bool   $critical
48
-     * @param string $data
49
-     *
50
-     * @return self
51
-     */
52
-    public static function fromRawString(string $oid, bool $critical,
53
-        string $data): self
54
-    {
55
-        $obj = new self($oid, $critical, new OctetString(''));
56
-        $obj->_element = null;
57
-        $obj->_data = $data;
58
-        return $obj;
59
-    }
43
+	/**
44
+	 * Create instance from a raw encoded extension value.
45
+	 *
46
+	 * @param string $oid
47
+	 * @param bool   $critical
48
+	 * @param string $data
49
+	 *
50
+	 * @return self
51
+	 */
52
+	public static function fromRawString(string $oid, bool $critical,
53
+		string $data): self
54
+	{
55
+		$obj = new self($oid, $critical, new OctetString(''));
56
+		$obj->_element = null;
57
+		$obj->_data = $data;
58
+		return $obj;
59
+	}
60 60
 
61
-    /**
62
-     * Get the encoded extension value.
63
-     *
64
-     * @return string
65
-     */
66
-    public function extensionValue(): string
67
-    {
68
-        return $this->_data;
69
-    }
61
+	/**
62
+	 * Get the encoded extension value.
63
+	 *
64
+	 * @return string
65
+	 */
66
+	public function extensionValue(): string
67
+	{
68
+		return $this->_data;
69
+	}
70 70
 
71
-    /**
72
-     * {@inheritdoc}
73
-     */
74
-    protected function _extnValue(): OctetString
75
-    {
76
-        return new OctetString($this->_data);
77
-    }
71
+	/**
72
+	 * {@inheritdoc}
73
+	 */
74
+	protected function _extnValue(): OctetString
75
+	{
76
+		return new OctetString($this->_data);
77
+	}
78 78
 
79
-    /**
80
-     * {@inheritdoc}
81
-     */
82
-    protected function _valueASN1(): Element
83
-    {
84
-        if (!isset($this->_element)) {
85
-            throw new \RuntimeException('Extension value is not DER encoded.');
86
-        }
87
-        return $this->_element;
88
-    }
79
+	/**
80
+	 * {@inheritdoc}
81
+	 */
82
+	protected function _valueASN1(): Element
83
+	{
84
+		if (!isset($this->_element)) {
85
+			throw new \RuntimeException('Extension value is not DER encoded.');
86
+		}
87
+		return $this->_element;
88
+	}
89 89
 }
Please login to merge, or discard this patch.
X509/Certificate/Extension/AccessDescription/AuthorityAccessDescription.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,31 +9,31 @@
 block discarded – undo
9 9
  */
10 10
 class AuthorityAccessDescription extends AccessDescription
11 11
 {
12
-    /**
13
-     * Access method OID's.
14
-     *
15
-     * @var string
16
-     */
17
-    const OID_METHOD_OSCP = '1.3.6.1.5.5.7.48.1';
18
-    const OID_METHOD_CA_ISSUERS = '1.3.6.1.5.5.7.48.2';
12
+	/**
13
+	 * Access method OID's.
14
+	 *
15
+	 * @var string
16
+	 */
17
+	const OID_METHOD_OSCP = '1.3.6.1.5.5.7.48.1';
18
+	const OID_METHOD_CA_ISSUERS = '1.3.6.1.5.5.7.48.2';
19 19
 
20
-    /**
21
-     * Check whether access method is OSCP.
22
-     *
23
-     * @return bool
24
-     */
25
-    public function isOSCPMethod(): bool
26
-    {
27
-        return self::OID_METHOD_OSCP === $this->_accessMethod;
28
-    }
20
+	/**
21
+	 * Check whether access method is OSCP.
22
+	 *
23
+	 * @return bool
24
+	 */
25
+	public function isOSCPMethod(): bool
26
+	{
27
+		return self::OID_METHOD_OSCP === $this->_accessMethod;
28
+	}
29 29
 
30
-    /**
31
-     * Check whether access method is CA issuers.
32
-     *
33
-     * @return bool
34
-     */
35
-    public function isCAIssuersMethod(): bool
36
-    {
37
-        return self::OID_METHOD_CA_ISSUERS === $this->_accessMethod;
38
-    }
30
+	/**
31
+	 * Check whether access method is CA issuers.
32
+	 *
33
+	 * @return bool
34
+	 */
35
+	public function isCAIssuersMethod(): bool
36
+	{
37
+		return self::OID_METHOD_CA_ISSUERS === $this->_accessMethod;
38
+	}
39 39
 }
Please login to merge, or discard this patch.
X509/Certificate/Extension/AccessDescription/SubjectAccessDescription.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,31 +9,31 @@
 block discarded – undo
9 9
  */
10 10
 class SubjectAccessDescription extends AccessDescription
11 11
 {
12
-    /**
13
-     * Access method OID's.
14
-     *
15
-     * @var string
16
-     */
17
-    const OID_METHOD_TIME_STAMPING = '1.3.6.1.5.5.7.48.3';
18
-    const OID_METHOD_CA_REPOSITORY = '1.3.6.1.5.5.7.48.5';
12
+	/**
13
+	 * Access method OID's.
14
+	 *
15
+	 * @var string
16
+	 */
17
+	const OID_METHOD_TIME_STAMPING = '1.3.6.1.5.5.7.48.3';
18
+	const OID_METHOD_CA_REPOSITORY = '1.3.6.1.5.5.7.48.5';
19 19
 
20
-    /**
21
-     * Check whether access method is time stamping.
22
-     *
23
-     * @return bool
24
-     */
25
-    public function isTimeStampingMethod(): bool
26
-    {
27
-        return self::OID_METHOD_TIME_STAMPING === $this->_accessMethod;
28
-    }
20
+	/**
21
+	 * Check whether access method is time stamping.
22
+	 *
23
+	 * @return bool
24
+	 */
25
+	public function isTimeStampingMethod(): bool
26
+	{
27
+		return self::OID_METHOD_TIME_STAMPING === $this->_accessMethod;
28
+	}
29 29
 
30
-    /**
31
-     * Check whether access method is CA repository.
32
-     *
33
-     * @return bool
34
-     */
35
-    public function isCARepositoryMethod(): bool
36
-    {
37
-        return self::OID_METHOD_CA_REPOSITORY === $this->_accessMethod;
38
-    }
30
+	/**
31
+	 * Check whether access method is CA repository.
32
+	 *
33
+	 * @return bool
34
+	 */
35
+	public function isCARepositoryMethod(): bool
36
+	{
37
+		return self::OID_METHOD_CA_REPOSITORY === $this->_accessMethod;
38
+	}
39 39
 }
Please login to merge, or discard this patch.