protected function removeDirectory($path)
    {
        $files = glob($path . '/*');
        foreach ($files as $file) {
            if (is_dir($file)) {
                static::removeDirectory($file);
            } else if (basename($file) !== '.gitignore') {
                unlink($file);
            }
        }
        if ($path !== $this->cacheRoot) {
            rmdir($path);
        }

        return;
    }
protected function removeDirectory($path)
    {
        $files = glob($path . '/*');
        foreach ($files as $file) {
            if (is_dir($file)) {
                static::removeDirectory($file);
            } else if (basename($file) !== '.gitignore') {
                unlink($file);
            }
        }
        if ($path !== $this->cacheRoot) {
            rmdir($path);
        }

        return;
    }
protected function removeDirectory ( $ path ) { $ files = glob ( $ path . '/*' ) ; foreach ( $ files as $ file ) { if ( is_dir ( $ file ) ) { static :: removeDirectory ( $ file ) ; } else if ( basename ( $ file ) !== '.gitignore' ) { unlink ( $ file ) ; } } if ( $ path !== $ this -> cacheRoot ) { rmdir ( $ path ) ; } return ; }
Removes directories recursively.

@param $path
Removes directories recursively .