ExceptionsOption.php 850 B

12345678910111213141516171819202122232425262728293031323334353637
  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. /**
  12. * Configures whether consumers (such as the client) should throw exceptions on
  13. * Redis errors (-ERR responses) or just return instances of error responses.
  14. *
  15. * @author Daniele Alessandri <suppakilla@gmail.com>
  16. */
  17. class ExceptionsOption implements OptionInterface
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public function filter(OptionsInterface $options, $value)
  23. {
  24. return filter_var($value, FILTER_VALIDATE_BOOLEAN);
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function getDefault(OptionsInterface $options)
  30. {
  31. return true;
  32. }
  33. }