ClientProfile.php 802 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. use Predis\Profiles\ServerProfile;
  12. use Predis\Profiles\IServerProfile;
  13. class ClientProfile extends Option
  14. {
  15. public function validate($value)
  16. {
  17. if ($value instanceof IServerProfile) {
  18. return $value;
  19. }
  20. if (is_string($value)) {
  21. return ServerProfile::get($value);
  22. }
  23. throw new \InvalidArgumentException(
  24. "Invalid value for the profile option"
  25. );
  26. }
  27. public function getDefault()
  28. {
  29. return ServerProfile::getDefault();
  30. }
  31. }