CommandInterface.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /*
  3. * This file is part of the Predis package.
  4. *
  5. * (c) Daniele Alessandri <suppakilla@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 Predis\Command;
  11. /**
  12. * Defines an abstraction representing a Redis command.
  13. * @author Daniele Alessandri <suppakilla@gmail.com>
  14. */
  15. interface CommandInterface
  16. {
  17. /**
  18. * Gets the ID of a Redis command.
  19. *
  20. * @return string
  21. */
  22. public function getId();
  23. /**
  24. * Set the hash for the command.
  25. *
  26. * @param int $hash Calculated hash.
  27. */
  28. public function setHash($hash);
  29. /**
  30. * Returns the hash of the command.
  31. *
  32. * @return int
  33. */
  34. public function getHash();
  35. /**
  36. * Sets the arguments for the command.
  37. *
  38. * @param array $arguments List of arguments.
  39. */
  40. public function setArguments(array $arguments);
  41. /**
  42. * Sets the raw arguments for the command without processing them.
  43. *
  44. * @param array $arguments List of arguments.
  45. */
  46. public function setRawArguments(array $arguments);
  47. /**
  48. * Gets the arguments of the command.
  49. *
  50. * @return array
  51. */
  52. public function getArguments();
  53. /**
  54. * Gets the argument of the command at the specified index.
  55. *
  56. * @return array
  57. */
  58. public function getArgument($index);
  59. /**
  60. * Parses a reply buffer and returns a PHP object.
  61. *
  62. * @param string $data Binary string containing the whole reply.
  63. * @return mixed
  64. */
  65. public function parseResponse($data);
  66. }