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