Ejemplo n.º 1
0
 /**
  * @param string $name
  * @param \Wandu\Console\Command $command
  */
 public function __construct($name, Command $command)
 {
     parent::__construct($name);
     $this->command = $command;
     $this->setDescription($command->getDescription());
     $this->setHelp($command->getHelp());
     // arguments
     foreach ($command->getArguments() as $argument => $description) {
         if (substr($argument, -1) === '?') {
             $this->addArgument(substr($argument, 0, -1), InputArgument::OPTIONAL, $description);
         } elseif (substr($argument, -2) === '[]') {
             $this->addArgument(substr($argument, 0, -2), InputArgument::IS_ARRAY, $description);
         } else {
             $this->addArgument($argument, InputArgument::REQUIRED, $description);
         }
     }
 }