DMS\Filter\Filters\Zend::getZendInstance PHP Method

getZendInstance() public method

Instantiates a configured Zend Filter, if it exists
public getZendInstance ( string $class, array $options ) : Zend\Filter\FilterInterface
$class string
$options array
return Zend\Filter\FilterInterface
    public function getZendInstance($class, $options)
    {
        if (strpos($class, 'Zend\\Filter') === false) {
            $class = "Zend\\Filter\\" . $class;
        }
        if (!class_exists($class)) {
            throw new InvalidZendFilterException("Could not find or autoload: {$class}");
        }
        try {
            new \ReflectionMethod($class, 'setOptions');
            $filter = new $class();
            $filter->setOptions($options);
            return $filter;
        } catch (\ReflectionException $e) {
            return new $class($options);
        }
    }