CommandInterface.php 1.7 KB

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