Example #1
0
 /**
  * Writes the class to a file.
  */
 public function write()
 {
     try {
         $dir = $this->path->isDir() ? $this->path->getPathname() : $this->path->getPath();
         $path = $dir . '/' . $this->baseClass->getClassName() . $this->baseClass->getExtension();
         if (!file_exists($dir)) {
             $this->fileSystem->mkdir($dir, 0777, true);
         }
         //if (!file_exists($path)) {
         file_put_contents($path, $this->baseClass->generate());
         //}
     } catch (IOExceptionInterface $e) {
     }
 }
 /**
  * @return string
  */
 protected function generateAnnotation()
 {
     $annotations = PHP_EOL . '/**' . PHP_EOL;
     $annotations .= ' * Class ' . $this->baseClass->getClassName() . PHP_EOL;
     $annotations .= ' *' . PHP_EOL;
     if ($this->baseClass->hasNameSpace()) {
         $annotations .= ' * @package ' . $this->baseClass->getNameSpace() . PHP_EOL;
     }
     foreach ($this->baseClass->getAnnotations() as $annotation) {
         $annotations .= $annotation->generate() . PHP_EOL;
     }
     $annotations .= ' */';
     return $annotations;
 }