public function getAllFiles($sources)
    {
        $files = array();
        foreach ($sources as $source) {
            if (!is_dir($source)) {
                $files[] = $source;
                continue;
            }

            $recursiveFiles = new RecursiveIteratorIterator(
                new RecursiveDirectoryIterator($source)
            );
            foreach ($recursiveFiles as $file) {
                if ($file->isDir()) {
                    continue;
                }

                $path = $file->getPathname();
                $info = pathinfo(basename($path));

                if (array_key_exists('extension', $info) && $info['extension'] == 'php') {
                    $files[] = $path;
                }
            }
        }

        return $files;
    }
public function getAllFiles($sources)
    {
        $files = array();
        foreach ($sources as $source) {
            if (!is_dir($source)) {
                $files[] = $source;
                continue;
            }

            $recursiveFiles = new RecursiveIteratorIterator(
                new RecursiveDirectoryIterator($source)
            );
            foreach ($recursiveFiles as $file) {
                if ($file->isDir()) {
                    continue;
                }

                $path = $file->getPathname();
                $info = pathinfo(basename($path));

                if (array_key_exists('extension', $info) && $info['extension'] == 'php') {
                    $files[] = $path;
                }
            }
        }

        return $files;
    }
public function getAllFiles ( $ sources ) { $ files = array ( ) ; foreach ( $ sources as $ source ) { if ( ! is_dir ( $ source ) ) { $ files [ ] = $ source ; continue ; } $ recursiveFiles = new RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ source ) ) ; foreach ( $ recursiveFiles as $ file ) { if ( $ file -> isDir ( ) ) { continue ; } $ path = $ file -> getPathname ( ) ; $ info = pathinfo ( basename ( $ path ) ) ; if ( array_key_exists ( 'extension' , $ info ) && $ info [ 'extension' ] == 'php' ) { $ files [ ] = $ path ; } } } return $ files ; }
Check how of list is dir and find all files.

@param array $sources List of files/dirs

@return array List of files only
Check how of list is dir and find all files .