mirror of
https://github.com/predis/predis.git
synced 2026-09-12 19:37:05 +00:00
Merge branch 'v1.0/custom-parameters'
This commit is contained in:
@@ -76,7 +76,7 @@ class Factory implements FactoryInterface
|
||||
public function create($parameters)
|
||||
{
|
||||
if (!$parameters instanceof ParametersInterface) {
|
||||
$parameters = Parameters::create($parameters);
|
||||
$parameters = $this->createParameters($parameters);
|
||||
}
|
||||
|
||||
$scheme = $parameters->scheme;
|
||||
@@ -114,6 +114,17 @@ class Factory implements FactoryInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a connection parameters instance from the supplied argument.
|
||||
*
|
||||
* @param mixed $parameters Original connection parameters.
|
||||
* @return ParametersInterface
|
||||
*/
|
||||
protected function createParameters($parameters)
|
||||
{
|
||||
return Parameters::create($parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares a connection instance after its initialization.
|
||||
*
|
||||
|
||||
@@ -57,10 +57,10 @@ class Parameters implements ParametersInterface
|
||||
public static function create($parameters)
|
||||
{
|
||||
if (is_string($parameters)) {
|
||||
$parameters = self::parse($parameters);
|
||||
$parameters = static::parse($parameters);
|
||||
}
|
||||
|
||||
return new self($parameters ?: array());
|
||||
return new static($parameters ?: array());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user