ClientConnectionFactory.php 453 B

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