CommandInterface.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. * @param int $index Index of the desired argument.
  57. * @return mixed
  58. */
  59. public function getArgument($index);
  60. /**
  61. * Parses a reply buffer and returns a PHP object.
  62. *
  63. * @param string $data Binary string containing the whole reply.
  64. * @return mixed
  65. */
  66. public function parseResponse($data);
  67. }