protected function loadModules(DirectoryIterator $files, array $config = [])
    {
        foreach ($files as $file) {
            $filename = $file->getFilename();
            if ($file->isDot() || $file->isDir() || $filename[0] == '.') {
                continue;
            } elseif ($file->isFile() && substr($filename, -4) != '.php') {
                continue;
            } else {
                try {
                    $this->load(substr($filename, 0, -4), $config);
                } catch (Exception $e) {
                    throw new RuntimeException(sprintf('Error while loading module : %s', $e->getMessage()));
                }
            }
        }
    }
protected function loadModules(DirectoryIterator $files, array $config = [])
    {
        foreach ($files as $file) {
            $filename = $file->getFilename();
            if ($file->isDot() || $file->isDir() || $filename[0] == '.') {
                continue;
            } elseif ($file->isFile() && substr($filename, -4) != '.php') {
                continue;
            } else {
                try {
                    $this->load(substr($filename, 0, -4), $config);
                } catch (Exception $e) {
                    throw new RuntimeException(sprintf('Error while loading module : %s', $e->getMessage()));
                }
            }
        }
    }
protected function loadModules ( DirectoryIterator $ files , array $ config = [ ] ) { foreach ( $ files as $ file ) { $ filename = $ file -> getFilename ( ) ; if ( $ file -> isDot ( ) || $ file -> isDir ( ) || $ filename [ 0 ] == '.' ) { continue ; } elseif ( $ file -> isFile ( ) && substr ( $ filename , - 4 ) != '.php' ) { continue ; } else { try { $ this -> load ( substr ( $ filename , 0 , - 4 ) , $ config ) ; } catch ( Exception $ e ) { throw new RuntimeException ( sprintf ( 'Error while loading module : %s' , $ e -> getMessage ( ) ) ) ; } } } }
Loads the list of modules in the DirectoryIterator.

Options :
- pathDir : The full path of the Modules directory. Default to MODULE_DIR.
- plugin : The plugin name or false if no plugin. Default to false.

@param \DirectoryIterator $files The DirectoryIterator instance.
@param array $config The configuration options.

@throws \RuntimeException When the class doesn't implement the ModuleInterface.

@return string
Loads the list of modules in the DirectoryIterator .