/** * @throws \Dive\Console\ConsoleException */ private function createModelGenerator() { $formatter = new PhpClassFormatter(); $modelGenerator = new ModelGenerator($formatter); $modelGenerator->setAuthor('Dive ModelGenerator')->setEndOfLine($this->getEndOfLine()); $createdOnDate = $this->getCreatedOnDate(); if ($createdOnDate) { $modelGenerator->setCreatedOn($this->getCreatedOnDate()); } $licenseFile = $this->getParam('license-file'); if ($licenseFile) { if (!is_file($licenseFile)) { throw new ConsoleException("Could not open license file '{$licenseFile}'!"); } $license = trim(file_get_contents($licenseFile)); $modelGenerator->setLicense($license); } $this->modelGenerator = $modelGenerator; }
/** * @return ModelGenerator */ private function createModelGenerator() { $formatter = $this->getFormatter(); $modelGenerator = new ModelGenerator($formatter); return $modelGenerator->setLicense($this->getLicense(self::EOL))->setEndOfLine(self::EOL)->setAuthor(self::AUTHOR, self::MAIL)->setCreatedOn(self::DATE); }