ServerConfig.php 951 B

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