OptionInterface.php 1.2 KB

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\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 ClientOptionsInterface $options Options container.
  22. * @param mixed $value Input value.
  23. * @return mixed
  24. */
  25. public function filter(ClientOptionsInterface $options, $value);
  26. /**
  27. * Returns a default value for the option.
  28. *
  29. * @param ClientOptionsInterface $options Options container.
  30. * @return mixed
  31. */
  32. public function getDefault(ClientOptionsInterface $options);
  33. /**
  34. * Filters a value and, if no value is specified, returns the default one
  35. * defined by the option.
  36. *
  37. * @param ClientOptionsInterface $options Options container.
  38. * @param mixed $value Input value.
  39. * @return mixed
  40. */
  41. public function __invoke(ClientOptionsInterface $options, $value);
  42. }