PrefixOption.php 852 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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\Configuration;
  11. use Predis\Command\Processor\KeyPrefixProcessor;
  12. /**
  13. * Configures a command processor that apply the specified
  14. * prefix string to a series of Redis commands considered
  15. * prefixable.
  16. *
  17. * @author Daniele Alessandri <suppakilla@gmail.com>
  18. */
  19. class PrefixOption implements OptionInterface
  20. {
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function filter(OptionsInterface $options, $value)
  25. {
  26. return new KeyPrefixProcessor($value);
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function getDefault(OptionsInterface $options)
  32. {
  33. // NOOP
  34. }
  35. }