Option.php 613 B

12345678910111213141516171819202122232425262728293031323334
  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\Options;
  11. class Option implements IOption
  12. {
  13. public function validate($value)
  14. {
  15. return $value;
  16. }
  17. public function getDefault()
  18. {
  19. return null;
  20. }
  21. public function __invoke($value)
  22. {
  23. if (isset($value)) {
  24. return $this->validate($value);
  25. }
  26. return $this->getDefault();
  27. }
  28. }