ClientProfile.php 568 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace Predis\Options;
  3. use Predis\Profiles\ServerProfile;
  4. use Predis\Profiles\IServerProfile;
  5. class ClientProfile extends Option
  6. {
  7. public function validate($value)
  8. {
  9. if ($value instanceof IServerProfile) {
  10. return $value;
  11. }
  12. if (is_string($value)) {
  13. return ServerProfile::get($value);
  14. }
  15. throw new \InvalidArgumentException(
  16. "Invalid value for the profile option"
  17. );
  18. }
  19. public function getDefault()
  20. {
  21. return ServerProfile::getDefault();
  22. }
  23. }