ServerConfig.php 995 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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/config-set
  13. * @link http://redis.io/commands/config-get
  14. * @link http://redis.io/commands/config-resetstat
  15. * @link http://redis.io/commands/config-rewrite
  16. *
  17. * @author Daniele Alessandri <suppakilla@gmail.com>
  18. */
  19. class ServerConfig extends Command
  20. {
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function getId()
  25. {
  26. return 'CONFIG';
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function parseResponse($data)
  32. {
  33. if (is_array($data)) {
  34. $result = array();
  35. for ($i = 0; $i < count($data); ++$i) {
  36. $result[$data[$i]] = $data[++$i];
  37. }
  38. return $result;
  39. }
  40. return $data;
  41. }
  42. }