final protected function getClassForType($type)
    {
        if (!class_exists($type)) {
            throw new FilterDoesNotExistException("Filter class {$type} does not exist");
        }
        $filter = new $type;
        if (! ($filter instanceof FilterInterface)) {
            throw new FilterDoesNotExistException(
                "Filter class {$type} must implement " . FilterInterface::class
            );
        }

        return $filter;
    }