NumericString.php 841 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. class NumericString extends AbstractString
  14. {
  15. /**
  16. * Creates a new ASN.1 NumericString.
  17. *
  18. * The following characters are permitted:
  19. * Digits 0,1, ... 9
  20. * SPACE (space)
  21. *
  22. * @param string $string
  23. */
  24. public function __construct($string)
  25. {
  26. $this->value = $string;
  27. $this->allowNumbers();
  28. $this->allowSpaces();
  29. }
  30. public function getType()
  31. {
  32. return Identifier::NUMERIC_STRING;
  33. }
  34. }