protected function updateSources(array $originalSources, array $filteredSources, array $updatedSources)
    {
        $sources = [];
        $filteredPath = [];

        foreach ($filteredSources as $filteredSource) {
            $filteredPath[] = $filteredSource->getPath();
        }
        // keep only the not filtered files
        foreach ($originalSources as $originalSource) {

            // if an original source is not used by the current filter, we keep it in the source list
            if (!in_array($originalSource->getPath(), $filteredPath)) {
                $sources[] = $originalSource;
            }
        }
        // check updated files
        foreach ($updatedSources as $index => $source) {
            if (is_string($source)) {
                $updatedSources[$index] = new SplFileInfo($source);
            } else if (!($source instanceof SplFileInfo)) {
                throw new Exception('Invalid source file type '.gettype($source));
            }
        }
        // merge with the new sources
        $sources = array_merge($sources, $updatedSources);

        return $sources;
    }
protected function updateSources(array $originalSources, array $filteredSources, array $updatedSources)
    {
        $sources = [];
        $filteredPath = [];

        foreach ($filteredSources as $filteredSource) {
            $filteredPath[] = $filteredSource->getPath();
        }
        // keep only the not filtered files
        foreach ($originalSources as $originalSource) {

            // if an original source is not used by the current filter, we keep it in the source list
            if (!in_array($originalSource->getPath(), $filteredPath)) {
                $sources[] = $originalSource;
            }
        }
        // check updated files
        foreach ($updatedSources as $index => $source) {
            if (is_string($source)) {
                $updatedSources[$index] = new SplFileInfo($source);
            } else if (!($source instanceof SplFileInfo)) {
                throw new Exception('Invalid source file type '.gettype($source));
            }
        }
        // merge with the new sources
        $sources = array_merge($sources, $updatedSources);

        return $sources;
    }
protected function updateSources ( array $ originalSources , array $ filteredSources , array $ updatedSources ) { $ sources = [ ] ; $ filteredPath = [ ] ; foreach ( $ filteredSources as $ filteredSource ) { $ filteredPath [ ] = $ filteredSource -> getPath ( ) ; } // keep only the not filtered files foreach ( $ originalSources as $ originalSource ) { // if an original source is not used by the current filter, we keep it in the source list if ( ! in_array ( $ originalSource -> getPath ( ) , $ filteredPath ) ) { $ sources [ ] = $ originalSource ; } } // check updated files foreach ( $ updatedSources as $ index => $ source ) { if ( is_string ( $ source ) ) { $ updatedSources [ $ index ] = new SplFileInfo ( $ source ) ; } else if ( ! ( $ source instanceof SplFileInfo ) ) { throw new Exception ( 'Invalid source file type ' . gettype ( $ source ) ) ; } } // merge with the new sources $ sources = array_merge ( $ sources , $ updatedSources ) ; return $ sources ; }
Remove the filtered files from the sources, and merge with the new ones.

@param SplFileInfo[] $originalSources
@param SplFileInfo[] $filteredSources
@param SplFileInfo[] $updatedSources
@return SplFileInfo[]
@throws Exception
Remove the filtered files from the sources and merge with the new ones .