PdfToken.php 879 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * This file is part of FPDI
  4. *
  5. * @package Fpdi
  6. * @copyright Copyright (c) 2020 Setasign GmbH & Co. KG (https://www.setasign.com)
  7. * @license http://opensource.org/licenses/mit-license The MIT License
  8. */
  9. namespace Fpdi\PdfParser\Type;
  10. /**
  11. * Class representing PDF token object
  12. */
  13. class PdfToken extends PdfType
  14. {
  15. /**
  16. * Helper method to create an instance.
  17. *
  18. * @param string $token
  19. * @return self
  20. */
  21. public static function create($token)
  22. {
  23. $v = new self();
  24. $v->value = $token;
  25. return $v;
  26. }
  27. /**
  28. * Ensures that the passed value is a PdfToken instance.
  29. *
  30. * @param mixed $token
  31. * @return self
  32. * @throws PdfTypeException
  33. */
  34. public static function ensure($token)
  35. {
  36. return PdfType::ensureType(self::class, $token, 'Token value expected.');
  37. }
  38. }