public function filter(OptionsInterface $options, $value)
{
if ($value instanceof ReplicationInterface) {
return $value;
}
if (is_bool($value) || $value === null) {
return $value ? $this->getDefault($options) : null;
}
if ($value === 'sentinel') {
return function ($sentinels, $options) {
return new SentinelReplication($options->service, $sentinels, $options->connections);
};
}
if (!is_object($value) && null !== ($asbool = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE))) {
return $asbool ? $this->getDefault($options) : null;
}
throw new \InvalidArgumentException("An instance of type 'Predis\\Connection\\Aggregate\\ReplicationInterface' was expected.");
}