/** * Undo the last actions on the open zip file. * @param string $mixed * @return boolean @params mixed $mixed : undo changes to an archive by index(int), name(string), all ('all' | '*' | blank) usage : $this->Zip->undo(1); $this->Zip->undo('myText.txt'); $this->Zip->undo('*'); $this->Zip->undo('myText.txt, myText1.txt'); $this->Zip->undo(array(1, 'myText.txt')); */ function undo($mixed = '*') { if (is_array($mixed)) { foreach ($mixed as $value) { $constant = is_string($value) ? 'Name' : 'Index'; if (!$this->zip->{'unchange' . $constant}($value)) { return false; } } } else { $mixed = explode(',', $mixed); if (in_array($mixed[0], ['*', 'all'])) { if (!$this->zip->unchangeAll()) { return false; } } else { foreach ($mixed as $name) { if (!$this->zip->unchangeName($name)) { return false; } } } } return true; }