/** * @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()); }
public function process(&$return, $req) { $cf = new Change($this->settings, $this->changeFactory, $this->changeFactory->getCacher()); $cf->parseFile(DBC_EXECUTION_MODE == 'web' ? $req['file'] : $req[0]); $return['data'] = $cf->stringify(); }