ClientConnectionFactory.php 461 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace Predis\Options;
  3. use Predis\IConnectionFactory;
  4. use Predis\ConnectionFactory;
  5. class ClientConnectionFactory extends Option
  6. {
  7. public function validate($value)
  8. {
  9. if ($value instanceof IConnectionFactory) {
  10. return $value;
  11. }
  12. if (is_array($value)) {
  13. return new ConnectionFactory($value);
  14. }
  15. }
  16. public function getDefault()
  17. {
  18. return new ConnectionFactory();
  19. }
  20. }