コード例 #1
0
 /**
  * Logic that will be executed when command is visited
  *
  * @param AbstractCommand $command
  * @param int             $depth
  *
  * @return mixed
  */
 function process(AbstractCommand $command, $depth = 0)
 {
     if (is_null($this->argumentsContainer->getArgumentAt($this->currentIndex + 2))) {
         echo $command->getArgument() . ' ';
     } elseif (StaticStringy::startsWith($command->getArgument(), $this->argumentsContainer->getArgumentAt($this->currentIndex + 2))) {
         echo $command->getArgument() . ' ';
     }
 }
コード例 #2
0
 /**
  * Logic that will be executed when command is visited
  *
  * @param AbstractCommand $command
  * @param int             $depth
  *
  * @return mixed
  */
 function process(AbstractCommand $command, $depth = 0)
 {
     if ($command->getArgument() != $this->argumentsContainer->getArgumentAt($depth)) {
         return;
     }
     if (count($command->getChildCommands()) == 0) {
         $command->execute($this->argumentsContainer);
         $this->stop();
     } elseif ($this->argumentsContainer->getArgumentsCount() - 1 == $depth) {
         $command->execute($this->argumentsContainer);
         $this->stop();
     }
 }
コード例 #3
0
 /**
  * Logic that will be executed when command is visited
  *
  * @param AbstractCommand $command
  * @param int             $depth
  *
  * @return mixed
  */
 function process(AbstractCommand $command, $depth = 0)
 {
     $this->descriptions = array_merge($this->descriptions, $command->getDescriptions());
 }
コード例 #4
0
 /**
  * Add a new child command
  *
  * @param AbstractCommand $command
  */
 public function addChildCommand(AbstractCommand $command)
 {
     $this->childCommands[$command->getArgument()] = $command;
 }