コード例 #1
0
 /**
  * @param ClassDeclaration $declaration
  */
 protected function writeDeclaration(ClassDeclaration $declaration)
 {
     $filename = $this->config->elementFilename(static::ELEMENT, $this->argument('name'));
     $filename = $this->files->normalizePath($filename);
     if ($this->files->exists($filename)) {
         $this->writeln("<fg=red>Unable to write '<comment>{$declaration->getName()}</comment>' declaration, " . "file '<comment>{$filename}</comment>' already exists.</fg=red>");
         return;
     }
     $file = new FileDeclaration($this->elementNamespace(), $this->config->headerLines());
     $file->addElement($declaration);
     $this->files->write($filename, $file->render(), FilesInterface::READONLY, true);
     $this->writeln("Declaration of '<info>{$declaration->getName()}</info>' " . "has been successfully written into '<comment>{$filename}</comment>'.");
 }
コード例 #2
0
 /**
  * @param string $name
  * @param array  $parent
  * @param string $comment
  */
 public function __construct($name, $parent, $comment = '')
 {
     $reflection = new \ReflectionClass($parent);
     $this->parent = $reflection->getName();
     parent::__construct($name, $reflection->getShortName(), [], $comment);
     $this->declareStructure();
 }
コード例 #3
0
 /**
  * @param string $name
  * @param string $comment
  */
 public function __construct($name, $comment = '')
 {
     parent::__construct($name, '', ['MiddlewareInterface'], $comment);
     $this->declareStructure();
 }
コード例 #4
0
 /**
  * @param string $name
  * @param string $alias
  * @param string $comment
  */
 public function __construct($name, $alias, $comment = '')
 {
     parent::__construct($name, 'Command', [], $comment);
     $this->declareStructure();
     $this->setAlias($alias);
 }
コード例 #5
0
 /**
  * @param string $name
  * @param string $comment
  */
 public function __construct($name, $comment = '')
 {
     parent::__construct($name, 'Controller', [], $comment);
 }
コード例 #6
0
 /**
  * @param string $name
  * @param string $comment
  */
 public function __construct($name, $comment = '')
 {
     parent::__construct($name, 'Service', [], $comment);
 }
コード例 #7
0
 /**
  * @param string $name
  * @param string $comment
  */
 public function __construct($name, $comment = '')
 {
     parent::__construct($name, 'Migration', [], $comment);
     $this->declareStructure();
 }