Predis\Configuration\ConnectionFactoryOption::filter PHP Метод

filter() публичный Метод

public filter ( Predis\Configuration\OptionsInterface $options, $value )
$options Predis\Configuration\OptionsInterface
    public function filter(OptionsInterface $options, $value)
    {
        if ($value instanceof FactoryInterface) {
            return $value;
        } elseif (is_array($value)) {
            $factory = $this->getDefault($options);
            foreach ($value as $scheme => $initializer) {
                $factory->define($scheme, $initializer);
            }
            return $factory;
        } else {
            throw new \InvalidArgumentException('Invalid value provided for the connections option.');
        }
    }

Usage Example

 /**
  * @group disconnected
  * @expectedException InvalidArgumentException
  */
 public function testThrowsExceptionOnInvalidArguments()
 {
     $option = new ConnectionFactoryOption();
     $options = $this->getMock('Predis\\Configuration\\OptionsInterface');
     $option->filter($options, new \stdClass());
 }
ConnectionFactoryOption