protected function filterSources(array $sources, FilterInterface $filter)
    {
        $filteredSources = [];

        // if the filter supports no extension, there is an error
        if (!is_array($filter->getSupportedExtensions()) || !count($filter->getSupportedExtensions())) {
            throw new Exception('No supported extensions found for the filter '.$filter->getName());
        }

        foreach ($sources as $source) {
            $isExtensionSupported = in_array($source->getExtension(), $filter->getSupportedExtensions());
            $supportAllExtensions = in_array('*', $filter->getSupportedExtensions());

            if ($isExtensionSupported || $supportAllExtensions) {
                $filteredSources[] = $this
                    ->locator
                    ->getNormalizer()
                    ->normalize($source);
            }
        }

        return $filteredSources;
    }