public function findAllClasses(array $dirs, string $extension)
    {
        $classes = array();
        foreach ($dirs as $prefix => $dir) {
            /** @var $iterator \RecursiveIteratorIterator|\SplFileInfo[] */
            $iterator = new \RecursiveIteratorIterator(
                new \RecursiveDirectoryIterator($dir),
                \RecursiveIteratorIterator::LEAVES_ONLY
            );
            $nsPrefix = $prefix !== '' ? $prefix.'\\' : '';
            foreach ($iterator as $file) {
                if (($fileName = $file->getBasename('.'.$extension)) == $file->getBasename()) {
                    continue;
                }

                $classes[] = $nsPrefix.str_replace('.', '\\', $fileName);
            }
        }

        return $classes;
    }
public function findAllClasses(array $dirs, string $extension)
    {
        $classes = array();
        foreach ($dirs as $prefix => $dir) {
            /** @var $iterator \RecursiveIteratorIterator|\SplFileInfo[] */
            $iterator = new \RecursiveIteratorIterator(
                new \RecursiveDirectoryIterator($dir),
                \RecursiveIteratorIterator::LEAVES_ONLY
            );
            $nsPrefix = $prefix !== '' ? $prefix.'\\' : '';
            foreach ($iterator as $file) {
                if (($fileName = $file->getBasename('.'.$extension)) == $file->getBasename()) {
                    continue;
                }

                $classes[] = $nsPrefix.str_replace('.', '\\', $fileName);
            }
        }

        return $classes;
    }
public function findAllClasses ( array $ dirs , string $ extension ) { $ classes = array ( ) ; foreach ( $ dirs as $ prefix => $ dir ) { /** @var $iterator \RecursiveIteratorIterator|\SplFileInfo[] */ $ iterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ dir ) , \ RecursiveIteratorIterator :: LEAVES_ONLY ) ; $ nsPrefix = $ prefix !== '' ? $ prefix . '\\' : '' ; foreach ( $ iterator as $ file ) { if ( ( $ fileName = $ file -> getBasename ( '.' . $ extension ) ) == $ file -> getBasename ( ) ) { continue ; } $ classes [ ] = $ nsPrefix . str_replace ( '.' , '\\' , $ fileName ) ; } } return $ classes ; }
Find all classes by path and extension

@param array $dirs
@param string $extension
@return array
Find all classes by path and extension