IA5String.php 799 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /*
  3. * This file is part of the PHPASN1 library.
  4. *
  5. * Copyright © Friedrich Große <friedrich.grosse@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace FG\ASN1\Universal;
  11. use FG\ASN1\AbstractString;
  12. use FG\ASN1\Identifier;
  13. /**
  14. * The International Alphabet No.5 (IA5) references the encoding of the ASCII characters.
  15. *
  16. * Each character in the data is encoded as 1 byte.
  17. */
  18. class IA5String extends AbstractString
  19. {
  20. public function __construct($string)
  21. {
  22. parent::__construct($string);
  23. for ($i = 1; $i < 128; $i++) {
  24. $this->allowCharacter(chr($i));
  25. }
  26. }
  27. public function getType()
  28. {
  29. return Identifier::IA5_STRING;
  30. }
  31. }