mirror of
https://github.com/predis/predis.git
synced 2026-10-14 16:02:50 +00:00
Move the logic of the connection factory option to a dedicated class.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Predis\Options;
|
||||
|
||||
use Predis\IConnectionFactory;
|
||||
use Predis\ConnectionFactory;
|
||||
|
||||
class ClientConnectionFactory extends Option {
|
||||
public function validate($value) {
|
||||
if ($value instanceof IConnectionFactory) {
|
||||
return $value;
|
||||
}
|
||||
if (is_array($value)) {
|
||||
return new ConnectionFactory($value);
|
||||
}
|
||||
}
|
||||
|
||||
public function getDefault() {
|
||||
return new ConnectionFactory();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user