ZSetRangeByLex.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. * @link http://redis.io/commands/zrangebylex
  13. *
  14. * @author Daniele Alessandri <suppakilla@gmail.com>
  15. */
  16. class ZSetRangeByLex extends ZSetRange
  17. {
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public function getId()
  22. {
  23. return 'ZRANGEBYLEX';
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. protected function prepareOptions($options)
  29. {
  30. $opts = array_change_key_case($options, CASE_UPPER);
  31. $finalizedOpts = array();
  32. if (isset($opts['LIMIT']) && is_array($opts['LIMIT'])) {
  33. $limit = array_change_key_case($opts['LIMIT'], CASE_UPPER);
  34. $finalizedOpts[] = 'LIMIT';
  35. $finalizedOpts[] = isset($limit['OFFSET']) ? $limit['OFFSET'] : $limit[0];
  36. $finalizedOpts[] = isset($limit['COUNT']) ? $limit['COUNT'] : $limit[1];
  37. }
  38. return $finalizedOpts;
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. protected function withScores()
  44. {
  45. return false;
  46. }
  47. }