MathInterface.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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\Math;
  11. interface MathInterface
  12. {
  13. /**
  14. * Add two arbitrary-length integers.
  15. *
  16. * @param string $a
  17. * @param string $b
  18. *
  19. * @return string
  20. */
  21. public function add($a, $b);
  22. /**
  23. * Multiply two arbitrary-length integers.
  24. *
  25. * @param string $a
  26. * @param string $b
  27. *
  28. * @return string
  29. */
  30. public function multiply($a, $b);
  31. /**
  32. * Divide two arbitrary-length integers.
  33. *
  34. * @param string $a
  35. * @param string $b
  36. *
  37. * @return string
  38. */
  39. public function divide($a, $b);
  40. /**
  41. * Compute arbitrary-length integer modulo.
  42. *
  43. * @param string $n
  44. * @param string $d
  45. *
  46. * @return string
  47. */
  48. public function mod($n, $d);
  49. /**
  50. * Compares two arbitrary-length integers.
  51. *
  52. * @param string $a
  53. * @param string $b
  54. *
  55. * @return bool
  56. */
  57. public function greaterThan($a, $b);
  58. /**
  59. * Converts arbitrary-length integer to PHP integer.
  60. *
  61. * @param string $a
  62. *
  63. * @return int
  64. */
  65. public function intval($a);
  66. /**
  67. * Converts arbitrary-length integer to PHP string.
  68. *
  69. * @param string $a
  70. *
  71. * @return string
  72. */
  73. public function strval($a);
  74. /**
  75. * Converts PHP integer to arbitrary-length integer.
  76. *
  77. * @param int $a
  78. *
  79. * @return string
  80. */
  81. public function get($a);
  82. }