Example #1
0
 /**
  * @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;
 }