OptionInterface.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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\Option;
  11. /**
  12. * Interface that defines a client option.
  13. *
  14. * @author Daniele Alessandri <suppakilla@gmail.com>
  15. */
  16. interface OptionInterface
  17. {
  18. /**
  19. * Filters (and optionally converts) the passed value.
  20. *
  21. * @param mixed $value Input value.
  22. * @return mixed
  23. */
  24. public function filter(ClientOptionsInterface $options, $value);
  25. /**
  26. * Returns a default value for the option.
  27. *
  28. * @param mixed $value Input value.
  29. * @return mixed
  30. */
  31. public function getDefault(ClientOptionsInterface $options);
  32. /**
  33. * Filters a value and, if no value is specified, returns
  34. * the default one defined by the option.
  35. *
  36. * @param mixed $value Input value.
  37. * @return mixed
  38. */
  39. public function __invoke(ClientOptionsInterface $options, $value);
  40. }