PrefixableCommand.php 691 B

123456789101112131415161718192021222324252627282930
  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\Commands;
  11. /**
  12. * Base class for Redis commands with prefixable keys.
  13. *
  14. * @author Daniele Alessandri <suppakilla@gmail.com>
  15. */
  16. abstract class PrefixableCommand extends Command implements IPrefixable
  17. {
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public function prefixKeys($prefix)
  22. {
  23. $arguments = $this->getArguments();
  24. $arguments[0] = "$prefix{$arguments[0]}";
  25. $this->setRawArguments($arguments);
  26. }
  27. }