public function addFiles($files)
{
if (is_array($files)) {
foreach ($files as $key => $value) {
$files[$key] = realpath($value);
}
} else {
$files = array(realpath($files));
}
$result = !file_exists($this->path) ? $this->archive->open($this->path, \ZipArchive::CREATE) : $this->archive->open($this->path);
if ($result === true) {
foreach ($files as $file) {
if (!is_dir($file)) {
$this->archive->addFile($file, basename($file));
} else {
$this->addDir($file);
}
}
$this->archive->close();
}
}