mirror of
https://github.com/predis/predis.git
synced 2026-08-27 18:51:07 +00:00
Convert monolithic one-file-lib to a proper PSR-0 file tree
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Predis\Options;
|
||||
|
||||
class ClientKeyDistribution extends Option {
|
||||
public function validate($value) {
|
||||
if ($value instanceof \Predis\Distribution\IDistributionStrategy) {
|
||||
return $value;
|
||||
}
|
||||
if (is_string($value)) {
|
||||
$valueReflection = new \ReflectionClass($value);
|
||||
if ($valueReflection->isSubclassOf('\Predis\Distribution\IDistributionStrategy')) {
|
||||
return new $value;
|
||||
}
|
||||
}
|
||||
throw new \InvalidArgumentException("Invalid value for key distribution");
|
||||
}
|
||||
|
||||
public function getDefault() {
|
||||
return new \Predis\Distribution\HashRing();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user