Gc\Core\Updater\Adapter\Basic::addDirectoryToZip PHP Method

addDirectoryToZip() protected method

Add directory and children to zip
protected addDirectoryToZip ( ZipArchive $zip, string $directory, string[] $excludeDirectory = [] ) : ZipArchive
$zip ZipArchive Zip
$directory string Directory
$excludeDirectory string[] Exclude directory
return ZipArchive
    protected function addDirectoryToZip(ZipArchive $zip, $directory, $excludeDirectory = array())
    {
        $newFolder = str_replace(GC_APPLICATION_PATH, '', $directory);
        $zip->addEmptyDir($newFolder);
        $files = glob($directory . '/*');
        foreach ($files as $file) {
            if (in_array($file, $excludeDirectory)) {
                continue;
            }
            if (is_dir($file)) {
                $zip = $this->addDirectoryToZip($zip, $file, $excludeDirectory);
            } else {
                $newFile = str_replace(GC_APPLICATION_PATH, '', $file);
                $zip->addFile($file, $newFile);
            }
        }
        return $zip;
    }