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.

Code Duplication    Length = 7-8 lines in 28 locations

lib/ASN1/Type/UnspecifiedType.php 28 locations

@@ 105-111 (lines=7) @@
102
	 * @throws \UnexpectedValueException
103
	 * @return Boolean
104
	 */
105
	public function asBoolean() {
106
		if (!$this->_element instanceof Boolean) {
107
			throw new \UnexpectedValueException(
108
				$this->_generateExceptionMessage(Element::TYPE_BOOLEAN));
109
		}
110
		return $this->_element;
111
	}
112
	
113
	/**
114
	 * Get the wrapped element as an integer type.
@@ 119-125 (lines=7) @@
116
	 * @throws \UnexpectedValueException
117
	 * @return Integer
118
	 */
119
	public function asInteger() {
120
		if (!$this->_element instanceof Integer) {
121
			throw new \UnexpectedValueException(
122
				$this->_generateExceptionMessage(Element::TYPE_INTEGER));
123
		}
124
		return $this->_element;
125
	}
126
	
127
	/**
128
	 * Get the wrapped element as a bit string type.
@@ 133-139 (lines=7) @@
130
	 * @throws \UnexpectedValueException
131
	 * @return BitString
132
	 */
133
	public function asBitString() {
134
		if (!$this->_element instanceof BitString) {
135
			throw new \UnexpectedValueException(
136
				$this->_generateExceptionMessage(Element::TYPE_BIT_STRING));
137
		}
138
		return $this->_element;
139
	}
140
	
141
	/**
142
	 * Get the wrapped element as an octet string type.
@@ 147-153 (lines=7) @@
144
	 * @throws \UnexpectedValueException
145
	 * @return OctetString
146
	 */
147
	public function asOctetString() {
148
		if (!$this->_element instanceof OctetString) {
149
			throw new \UnexpectedValueException(
150
				$this->_generateExceptionMessage(Element::TYPE_OCTET_STRING));
151
		}
152
		return $this->_element;
153
	}
154
	
155
	/**
156
	 * Get the wrapped element as a null type.
@@ 161-167 (lines=7) @@
158
	 * @throws \UnexpectedValueException
159
	 * @return NullType
160
	 */
161
	public function asNull() {
162
		if (!$this->_element instanceof NullType) {
163
			throw new \UnexpectedValueException(
164
				$this->_generateExceptionMessage(Element::TYPE_NULL));
165
		}
166
		return $this->_element;
167
	}
168
	
169
	/**
170
	 * Get the wrapped element as an object identifier type.
@@ 175-182 (lines=8) @@
172
	 * @throws \UnexpectedValueException
173
	 * @return ObjectIdentifier
174
	 */
175
	public function asObjectIdentifier() {
176
		if (!$this->_element instanceof ObjectIdentifier) {
177
			throw new \UnexpectedValueException(
178
				$this->_generateExceptionMessage(
179
					Element::TYPE_OBJECT_IDENTIFIER));
180
		}
181
		return $this->_element;
182
	}
183
	
184
	/**
185
	 * Get the wrapped element as an object descriptor type.
@@ 190-197 (lines=8) @@
187
	 * @throws \UnexpectedValueException
188
	 * @return ObjectDescriptor
189
	 */
190
	public function asObjectDescriptor() {
191
		if (!$this->_element instanceof ObjectDescriptor) {
192
			throw new \UnexpectedValueException(
193
				$this->_generateExceptionMessage(
194
					Element::TYPE_OBJECT_DESCRIPTOR));
195
		}
196
		return $this->_element;
197
	}
198
	
199
	/**
200
	 * Get the wrapped element as a real type.
@@ 205-211 (lines=7) @@
202
	 * @throws \UnexpectedValueException
203
	 * @return Real
204
	 */
205
	public function asReal() {
206
		if (!$this->_element instanceof Real) {
207
			throw new \UnexpectedValueException(
208
				$this->_generateExceptionMessage(Element::TYPE_REAL));
209
		}
210
		return $this->_element;
211
	}
212
	
213
	/**
214
	 * Get the wrapped element as an enumerated type.
@@ 219-225 (lines=7) @@
216
	 * @throws \UnexpectedValueException
217
	 * @return Enumerated
218
	 */
219
	public function asEnumerated() {
220
		if (!$this->_element instanceof Enumerated) {
221
			throw new \UnexpectedValueException(
222
				$this->_generateExceptionMessage(Element::TYPE_ENUMERATED));
223
		}
224
		return $this->_element;
225
	}
226
	
227
	/**
228
	 * Get the wrapped element as a UTF8 string type.
@@ 233-239 (lines=7) @@
230
	 * @throws \UnexpectedValueException
231
	 * @return UTF8String
232
	 */
233
	public function asUTF8String() {
234
		if (!$this->_element instanceof UTF8String) {
235
			throw new \UnexpectedValueException(
236
				$this->_generateExceptionMessage(Element::TYPE_UTF8_STRING));
237
		}
238
		return $this->_element;
239
	}
240
	
241
	/**
242
	 * Get the wrapped element as a relative OID type.
@@ 247-253 (lines=7) @@
244
	 * @throws \UnexpectedValueException
245
	 * @return RelativeOID
246
	 */
247
	public function asRelativeOID() {
248
		if (!$this->_element instanceof RelativeOID) {
249
			throw new \UnexpectedValueException(
250
				$this->_generateExceptionMessage(Element::TYPE_RELATIVE_OID));
251
		}
252
		return $this->_element;
253
	}
254
	
255
	/**
256
	 * Get the wrapped element as a sequence type.
@@ 261-267 (lines=7) @@
258
	 * @throws \UnexpectedValueException
259
	 * @return Sequence
260
	 */
261
	public function asSequence() {
262
		if (!$this->_element instanceof Sequence) {
263
			throw new \UnexpectedValueException(
264
				$this->_generateExceptionMessage(Element::TYPE_SEQUENCE));
265
		}
266
		return $this->_element;
267
	}
268
	
269
	/**
270
	 * Get the wrapped element as a set type.
@@ 275-281 (lines=7) @@
272
	 * @throws \UnexpectedValueException
273
	 * @return Set
274
	 */
275
	public function asSet() {
276
		if (!$this->_element instanceof Set) {
277
			throw new \UnexpectedValueException(
278
				$this->_generateExceptionMessage(Element::TYPE_SET));
279
		}
280
		return $this->_element;
281
	}
282
	
283
	/**
284
	 * Get the wrapped element as a numeric string type.
@@ 289-295 (lines=7) @@
286
	 * @throws \UnexpectedValueException
287
	 * @return NumericString
288
	 */
289
	public function asNumericString() {
290
		if (!$this->_element instanceof NumericString) {
291
			throw new \UnexpectedValueException(
292
				$this->_generateExceptionMessage(Element::TYPE_NUMERIC_STRING));
293
		}
294
		return $this->_element;
295
	}
296
	
297
	/**
298
	 * Get the wrapped element as a printable string type.
@@ 303-309 (lines=7) @@
300
	 * @throws \UnexpectedValueException
301
	 * @return PrintableString
302
	 */
303
	public function asPrintableString() {
304
		if (!$this->_element instanceof PrintableString) {
305
			throw new \UnexpectedValueException(
306
				$this->_generateExceptionMessage(Element::TYPE_PRINTABLE_STRING));
307
		}
308
		return $this->_element;
309
	}
310
	
311
	/**
312
	 * Get the wrapped element as a T61 string type.
@@ 317-323 (lines=7) @@
314
	 * @throws \UnexpectedValueException
315
	 * @return T61String
316
	 */
317
	public function asT61String() {
318
		if (!$this->_element instanceof T61String) {
319
			throw new \UnexpectedValueException(
320
				$this->_generateExceptionMessage(Element::TYPE_T61_STRING));
321
		}
322
		return $this->_element;
323
	}
324
	
325
	/**
326
	 * Get the wrapped element as a videotex string type.
@@ 331-337 (lines=7) @@
328
	 * @throws \UnexpectedValueException
329
	 * @return VideotexString
330
	 */
331
	public function asVideotexString() {
332
		if (!$this->_element instanceof VideotexString) {
333
			throw new \UnexpectedValueException(
334
				$this->_generateExceptionMessage(Element::TYPE_VIDEOTEX_STRING));
335
		}
336
		return $this->_element;
337
	}
338
	
339
	/**
340
	 * Get the wrapped element as a IA6 string type.
@@ 345-351 (lines=7) @@
342
	 * @throws \UnexpectedValueException
343
	 * @return IA5String
344
	 */
345
	public function asIA5String() {
346
		if (!$this->_element instanceof IA5String) {
347
			throw new \UnexpectedValueException(
348
				$this->_generateExceptionMessage(Element::TYPE_IA5_STRING));
349
		}
350
		return $this->_element;
351
	}
352
	
353
	/**
354
	 * Get the wrapped element as an UTC time type.
@@ 359-365 (lines=7) @@
356
	 * @throws \UnexpectedValueException
357
	 * @return UTCTime
358
	 */
359
	public function asUTCTime() {
360
		if (!$this->_element instanceof UTCTime) {
361
			throw new \UnexpectedValueException(
362
				$this->_generateExceptionMessage(Element::TYPE_UTC_TIME));
363
		}
364
		return $this->_element;
365
	}
366
	
367
	/**
368
	 * Get the wrapped element as a generalized time type.
@@ 373-379 (lines=7) @@
370
	 * @throws \UnexpectedValueException
371
	 * @return GeneralizedTime
372
	 */
373
	public function asGeneralizedTime() {
374
		if (!$this->_element instanceof GeneralizedTime) {
375
			throw new \UnexpectedValueException(
376
				$this->_generateExceptionMessage(Element::TYPE_GENERALIZED_TIME));
377
		}
378
		return $this->_element;
379
	}
380
	
381
	/**
382
	 * Get the wrapped element as a graphic string type.
@@ 387-393 (lines=7) @@
384
	 * @throws \UnexpectedValueException
385
	 * @return GraphicString
386
	 */
387
	public function asGraphicString() {
388
		if (!$this->_element instanceof GraphicString) {
389
			throw new \UnexpectedValueException(
390
				$this->_generateExceptionMessage(Element::TYPE_GRAPHIC_STRING));
391
		}
392
		return $this->_element;
393
	}
394
	
395
	/**
396
	 * Get the wrapped element as a visible string type.
@@ 401-407 (lines=7) @@
398
	 * @throws \UnexpectedValueException
399
	 * @return VisibleString
400
	 */
401
	public function asVisibleString() {
402
		if (!$this->_element instanceof VisibleString) {
403
			throw new \UnexpectedValueException(
404
				$this->_generateExceptionMessage(Element::TYPE_VISIBLE_STRING));
405
		}
406
		return $this->_element;
407
	}
408
	
409
	/**
410
	 * Get the wrapped element as a general string type.
@@ 415-421 (lines=7) @@
412
	 * @throws \UnexpectedValueException
413
	 * @return GeneralString
414
	 */
415
	public function asGeneralString() {
416
		if (!$this->_element instanceof GeneralString) {
417
			throw new \UnexpectedValueException(
418
				$this->_generateExceptionMessage(Element::TYPE_GENERAL_STRING));
419
		}
420
		return $this->_element;
421
	}
422
	
423
	/**
424
	 * Get the wrapped element as a universal string type.
@@ 429-435 (lines=7) @@
426
	 * @throws \UnexpectedValueException
427
	 * @return UniversalString
428
	 */
429
	public function asUniversalString() {
430
		if (!$this->_element instanceof UniversalString) {
431
			throw new \UnexpectedValueException(
432
				$this->_generateExceptionMessage(Element::TYPE_UNIVERSAL_STRING));
433
		}
434
		return $this->_element;
435
	}
436
	
437
	/**
438
	 * Get the wrapped element as a character string type.
@@ 443-449 (lines=7) @@
440
	 * @throws \UnexpectedValueException
441
	 * @return CharacterString
442
	 */
443
	public function asCharacterString() {
444
		if (!$this->_element instanceof CharacterString) {
445
			throw new \UnexpectedValueException(
446
				$this->_generateExceptionMessage(Element::TYPE_CHARACTER_STRING));
447
		}
448
		return $this->_element;
449
	}
450
	
451
	/**
452
	 * Get the wrapped element as a BMP string type.
@@ 457-463 (lines=7) @@
454
	 * @throws \UnexpectedValueException
455
	 * @return BMPString
456
	 */
457
	public function asBMPString() {
458
		if (!$this->_element instanceof BMPString) {
459
			throw new \UnexpectedValueException(
460
				$this->_generateExceptionMessage(Element::TYPE_BMP_STRING));
461
		}
462
		return $this->_element;
463
	}
464
	
465
	/**
466
	 * Get the wrapped element as any string type.
@@ 471-477 (lines=7) @@
468
	 * @throws \UnexpectedValueException
469
	 * @return StringType
470
	 */
471
	public function asString() {
472
		if (!$this->_element instanceof StringType) {
473
			throw new \UnexpectedValueException(
474
				$this->_generateExceptionMessage(Element::TYPE_STRING));
475
		}
476
		return $this->_element;
477
	}
478
	
479
	/**
480
	 * Get the wrapped element as any time type.
@@ 485-491 (lines=7) @@
482
	 * @throws \UnexpectedValueException
483
	 * @return TimeType
484
	 */
485
	public function asTime() {
486
		if (!$this->_element instanceof TimeType) {
487
			throw new \UnexpectedValueException(
488
				$this->_generateExceptionMessage(Element::TYPE_TIME));
489
		}
490
		return $this->_element;
491
	}
492
	
493
	/**
494
	 * Generate message for exceptions thrown by <code>as*</code> methods.