Install/Loader.php
public function loadFromDirectory($dir)
    {
        if (!is_dir($dir)) {
            throw new \InvalidArgumentException(sprintf('"%s" does not exist', $dir));
        }

        $installers = [];
        $includedFiles = [];

        $iterator = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($dir),
            \RecursiveIteratorIterator::LEAVES_ONLY
        );

        foreach ($iterator as $file) {
            if (($fileName = $file->getBasename($this->fileExtension)) == $file->getBasename()) {
                continue;
            }
            $sourceFile = realpath($file->getPathName());
            require_once $sourceFile;
            $includedFiles[] = $sourceFile;
        }
        $declared = get_declared_classes();

        foreach ($declared as $className) {
            $refClass = new \ReflectionClass($className);
            $sourceFile = $refClass->getFileName();

            if (in_array($sourceFile, $includedFiles) && !$this->isTransient($className)) {
                $installer = new $className;
                $installers[] = $installer;
                $this->addInstaller($installer);
            }
        }

        return $installers;
    }
public function loadFromDirectory($dir)
    {
        if (!is_dir($dir)) {
            throw new \InvalidArgumentException(sprintf('"%s" does not exist', $dir));
        }

        $installers = [];
        $includedFiles = [];

        $iterator = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($dir),
            \RecursiveIteratorIterator::LEAVES_ONLY
        );

        foreach ($iterator as $file) {
            if (($fileName = $file->getBasename($this->fileExtension)) == $file->getBasename()) {
                continue;
            }
            $sourceFile = realpath($file->getPathName());
            require_once $sourceFile;
            $includedFiles[] = $sourceFile;
        }
        $declared = get_declared_classes();

        foreach ($declared as $className) {
            $refClass = new \ReflectionClass($className);
            $sourceFile = $refClass->getFileName();

            if (in_array($sourceFile, $includedFiles) && !$this->isTransient($className)) {
                $installer = new $className;
                $installers[] = $installer;
                $this->addInstaller($installer);
            }
        }

        return $installers;
    }
public function loadFromDirectory ( $ dir ) { if ( ! is_dir ( $ dir ) ) { throw new \ InvalidArgumentException ( sprintf ( '"%s" does not exist' , $ dir ) ) ; } $ installers = [ ] ; $ includedFiles = [ ] ; $ iterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ dir ) , \ RecursiveIteratorIterator :: LEAVES_ONLY ) ; foreach ( $ iterator as $ file ) { if ( ( $ fileName = $ file -> getBasename ( $ this -> fileExtension ) ) == $ file -> getBasename ( ) ) { continue ; } $ sourceFile = realpath ( $ file -> getPathName ( ) ) ; require_once $ sourceFile ; $ includedFiles [ ] = $ sourceFile ; } $ declared = get_declared_classes ( ) ; foreach ( $ declared as $ className ) { $ refClass = new \ ReflectionClass ( $ className ) ; $ sourceFile = $ refClass -> getFileName ( ) ; if ( in_array ( $ sourceFile , $ includedFiles ) && ! $ this -> isTransient ( $ className ) ) { $ installer = new $ className ; $ installers [ ] = $ installer ; $ this -> addInstaller ( $ installer ) ; } } return $ installers ; }
Finds installer classes in a given directory and load them.

@param string $dir Directory to find installer classes in.
@return array $installers Array of loaded installer object instances.
Finds installer classes in a given directory and load them .