ServerConfig.php 1000 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. * @author Daniele Alessandri <suppakilla@gmail.com>
  17. */
  18. class ServerConfig extends AbstractCommand
  19. {
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function getId()
  24. {
  25. return 'CONFIG';
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function parseResponse($data)
  31. {
  32. if (is_array($data)) {
  33. $result = array();
  34. for ($i = 0; $i < count($data); $i++) {
  35. $result[$data[$i]] = $data[++$i];
  36. }
  37. return $result;
  38. }
  39. return $data;
  40. }
  41. }