public static function createZip($src, $withEmptyDir = false) {
        $zipArchive = new \ZipArchive();
        $path = self::createTempDir().'file.zip';
        if ($zipArchive->open($path, \ZipArchive::CREATE)!==TRUE) {
            throw new common_Exception('Unable to create zipfile '.$path);
        }
        self::addFilesToZip($zipArchive, $src, DIRECTORY_SEPARATOR, $withEmptyDir);
        $zipArchive->close();
        return $path;
    }