Example #1
0
 /**
  * Validate and add a file to the zip
  *
  * @param File $file File model object
  * @throws Exception If not a File model object
  * @since 0.5.0
  */
 public function add_file($file)
 {
     if (!$file instanceof File) {
         throw new Exception('File objects only added to files');
     }
     $file_id = $file->get_ID();
     if (null !== $file_id) {
         $this->files[$file_id] = $file;
     } else {
         $this->files[] = $file;
     }
 }