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. * By convention, command identifiers myst be uppercase.
  20. *
  21. * @return string
  22. */
  23. public function getId();
  24. /**
  25. * Set the hash for the command.
  26. *
  27. * @param int $hash Calculated hash.
  28. */
  29. public function setHash($hash);
  30. /**
  31. * Returns the hash of the command.
  32. *
  33. * @return int
  34. */
  35. public function getHash();
  36. /**
  37. * Sets the arguments for the command.
  38. *
  39. * @param array $arguments List of arguments.
  40. */
  41. public function setArguments(array $arguments);
  42. /**
  43. * Sets the raw arguments for the command without processing them.
  44. *
  45. * @param array $arguments List of arguments.
  46. */
  47. public function setRawArguments(array $arguments);
  48. /**
  49. * Gets the arguments of the command.
  50. *
  51. * @return array
  52. */
  53. public function getArguments();
  54. /**
  55. * Gets the argument of the command at the specified index.
  56. *
  57. * @return array
  58. */
  59. public function getArgument($index);
  60. /**
  61. * Parses a raw response and returns a PHP object.
  62. *
  63. * @param string $data Binary string containing the whole response.
  64. * @return mixed
  65. */
  66. public function parseResponse($data);
  67. }