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;
    }
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;
    }
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 ; }
Filter only the sources supported by the current filter.

@param SplFileInfo[] $sources
@param FilterInterface $filter
@return array
@throws Exception
Filter only the sources supported by the current filter .