ClientProfile.php 558 B

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