You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

58 lines
1.0 KiB

  1. <?php
  2. /*
  3. * This file is part of Hashids.
  4. *
  5. * (c) Ivan Akimov <ivan@barreleye.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 Hashids;
  11. /**
  12. * This is the hashids interface.
  13. *
  14. * @author Ivan Akimov <ivan@barreleye.com>
  15. * @author Vincent Klaiber <hello@doubledip.se>
  16. */
  17. interface HashidsInterface
  18. {
  19. /**
  20. * Encode parameters to generate a hash.
  21. *
  22. * @param mixed $numbers
  23. *
  24. * @return string
  25. */
  26. public function encode(...$numbers);
  27. /**
  28. * Decode a hash to the original parameter values.
  29. *
  30. * @param string $hash
  31. *
  32. * @return array
  33. */
  34. public function decode($hash);
  35. /**
  36. * Encode hexadecimal values and generate a hash string.
  37. *
  38. * @param string $str
  39. *
  40. * @return string
  41. */
  42. public function encodeHex($str);
  43. /**
  44. * Decode a hexadecimal hash.
  45. *
  46. * @param string $hash
  47. *
  48. * @return string
  49. */
  50. public function decodeHex($hash);
  51. }