protected function rebuildClassPathCache($path, $cacheFile)
    {
        $tmp = array();
        if ($cacheFile !== false) {
            $tmp             = $this->classPath;
            $this->classPath = array();
        }

        // iterates over all files/folders
        foreach (new \DirectoryIterator($path) as $fileInfo) {
            if (!$fileInfo->isDot()) {
                if ($fileInfo->isDir()) {
                    $this->rebuildClassPathCache($fileInfo->getPathname(), false);
                } else {
                    $this->classPath[$fileInfo->getBasename('.php')] = $fileInfo->getPathname();
                }
            }
        }

        // save in file if it's the first call (not recursed)
        if ($cacheFile !== false) {
            if (!file_put_contents($cacheFile, serialize($this->classPath), LOCK_EX)) {
                throw new Exception('Could not write into ' . $cacheFile . ', either because the folder is not there (create it) or because of the chmod configuration (please ensure this directory is writable by php), alternatively you can change the directory used with $dwoo->setCompileDir() or provide a custom loader object with $dwoo->setLoader()');
            }
            $this->classPath += $tmp;
        }
    }
protected function rebuildClassPathCache($path, $cacheFile)
    {
        $tmp = array();
        if ($cacheFile !== false) {
            $tmp             = $this->classPath;
            $this->classPath = array();
        }

        // iterates over all files/folders
        foreach (new \DirectoryIterator($path) as $fileInfo) {
            if (!$fileInfo->isDot()) {
                if ($fileInfo->isDir()) {
                    $this->rebuildClassPathCache($fileInfo->getPathname(), false);
                } else {
                    $this->classPath[$fileInfo->getBasename('.php')] = $fileInfo->getPathname();
                }
            }
        }

        // save in file if it's the first call (not recursed)
        if ($cacheFile !== false) {
            if (!file_put_contents($cacheFile, serialize($this->classPath), LOCK_EX)) {
                throw new Exception('Could not write into ' . $cacheFile . ', either because the folder is not there (create it) or because of the chmod configuration (please ensure this directory is writable by php), alternatively you can change the directory used with $dwoo->setCompileDir() or provide a custom loader object with $dwoo->setLoader()');
            }
            $this->classPath += $tmp;
        }
    }
protected function rebuildClassPathCache ( $ path , $ cacheFile ) { $ tmp = array ( ) ; if ( $ cacheFile !== false ) { $ tmp = $ this -> classPath ; $ this -> classPath = array ( ) ; } // iterates over all files/folders foreach ( new \ DirectoryIterator ( $ path ) as $ fileInfo ) { if ( ! $ fileInfo -> isDot ( ) ) { if ( $ fileInfo -> isDir ( ) ) { $ this -> rebuildClassPathCache ( $ fileInfo -> getPathname ( ) , false ) ; } else { $ this -> classPath [ $ fileInfo -> getBasename ( '.php' ) ] = $ fileInfo -> getPathname ( ) ; } } } // save in file if it's the first call (not recursed) if ( $ cacheFile !== false ) { if ( ! file_put_contents ( $ cacheFile , serialize ( $ this -> classPath ) , LOCK_EX ) ) { throw new Exception ( 'Could not write into ' . $ cacheFile . ', either because the folder is not there (create it) or because of the chmod configuration (please ensure this directory is writable by php), alternatively you can change the directory used with $dwoo->setCompileDir() or provide a custom loader object with $dwoo->setLoader()' ) ; } $ this -> classPath += $ tmp ; } }
Rebuilds class paths, scans the given directory recursively and saves all paths in the given file.

@param string         $path      the plugin path to scan
@param string|boolean $cacheFile the file where to store the plugin paths cache, it will be overwritten

@throws Exception
Rebuilds class paths scans the given directory recursively and saves all paths in the given file .