Пример #1
0
 /**
  * @param ChangeFile $cf
  * @param bool $overwrite
  * @throws Exception
  */
 public function store(Change $cf, $overwrite = true)
 {
     if ($cf->getIssueNumber() == '') {
         throw new Exception('Issue# is empty.');
     }
     if ((int) $cf->getIssueCount() == 0) {
         throw new Exception('Issue Count is empty.');
     }
     $filename = $cf->generateFilename($cf->getIssueNumber(), $cf->getIssueCount());
     if (!$overwrite) {
         if (parent::fileExists($this->getDir(self::FILE_ROOT), $filename)) {
             throw new Exception('Change already exists.');
         }
     }
     parent::save($this->getDir(self::FILE_ROOT), $filename, $cf->stringify());
 }