HashidsInterface.php 947 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Copyright (c) Ivan Akimov.
  4. *
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. *
  8. * @see https://github.com/vinkla/hashids
  9. */
  10. namespace app\utils\Hashids;
  11. interface HashidsInterface
  12. {
  13. /**
  14. * Encode parameters to generate a hash.
  15. *
  16. * @param mixed $numbers
  17. *
  18. * @return string
  19. */
  20. public function encode(...$numbers);
  21. /**
  22. * Decode a hash to the original parameter values.
  23. *
  24. * @param string $hash
  25. *
  26. * @return array
  27. */
  28. public function decode($hash);
  29. /**
  30. * Encode hexadecimal values and generate a hash string.
  31. *
  32. * @param string $str
  33. *
  34. * @return string
  35. */
  36. public function encodeHex($str);
  37. /**
  38. * Decode a hexadecimal hash.
  39. *
  40. * @param string $hash
  41. *
  42. * @return string
  43. */
  44. public function decodeHex($hash);
  45. }