當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Command::setDefinition方法代碼示例

本文整理匯總了PHP中Symfony\Component\Console\Command\Command::setDefinition方法的典型用法代碼示例。如果您正苦於以下問題:PHP Command::setDefinition方法的具體用法?PHP Command::setDefinition怎麽用?PHP Command::setDefinition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\Console\Command\Command的用法示例。


在下文中一共展示了Command::setDefinition方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: generateCommand

 /**
  * creates a Command based on an Api Method.
  *
  * @param string            $name
  * @param \ReflectionMethod $method
  * @param string            $token
  *
  * @return Command
  */
 private function generateCommand($name, \ReflectionMethod $method, $token = null)
 {
     $methodName = $this->transformer->transform($method->getName());
     $command = new Command(strtolower($name . ':' . $methodName));
     $docBlock = DocBlockFactory::createInstance()->create($method->getDocComment());
     $command->setDefinition($this->buildDefinition($method, $token));
     $command->setDescription($docBlock->getSummary());
     $command->setCode($this->createCode($name, $method));
     return $command;
 }
開發者ID:digitalkaoz,項目名稱:versioneye-php,代碼行數:19,代碼來源:CommandFactory.php

示例2: buildCommand

 /**
  * Build a Symfony Console commands.
  *
  * @param \Yosymfony\Spress\Plugin\CommandPluginInterface $commandPlugin
  *
  * @return \Symfony\Component\Console\Command\Command Symfony Console command.
  */
 protected function buildCommand(CommandPluginInterface $commandPlugin)
 {
     $definition = $commandPlugin->getCommandDefinition();
     $argumentsAndOptions = [];
     $consoleComand = new Command($definition->getName());
     $consoleComand->setDescription($definition->getDescription());
     $consoleComand->setHelp($definition->getHelp());
     foreach ($definition->getArguments() as list($name, $mode, $description, $defaultValue)) {
         $argumentsAndOptions[] = new InputArgument($name, $mode, $description, $defaultValue);
     }
     foreach ($definition->getOptions() as list($name, $shortcut, $mode, $description, $defaultValue)) {
         $argumentsAndOptions[] = new InputOption($name, $shortcut, $mode, $description, $defaultValue);
     }
     $consoleComand->setDefinition($argumentsAndOptions);
     $consoleComand->setCode(function (InputInterface $input, OutputInterface $output) use($commandPlugin) {
         $io = new ConsoleIO($input, $output);
         $arguments = $input->getArguments();
         $options = $input->getOptions();
         $commandPlugin->executeCommand($io, $arguments, $options);
     });
     return $consoleComand;
 }
開發者ID:jjk-jacky,項目名稱:Spress,代碼行數:29,代碼來源:ConsoleCommandBuilder.php

示例3: setDefinition

 /**
  * {@inheritdoc}
  */
 public function setDefinition($definition)
 {
     $this->decoratedCommand->setDefinition($definition);
     return $this;
 }
開發者ID:frankdejonge,項目名稱:locked-console-command,代碼行數:8,代碼來源:LockedCommandDecorator.php

示例4: setDefinition

 public function setDefinition($definition)
 {
     return $this->innerCommand->setDefinition($definition);
 }
開發者ID:lolautruche,項目名稱:ezsh,代碼行數:4,代碼來源:WrappedCommand.php

示例5: setInputDefinition

 /**
  * @param Command         $command
  * @param InputInterface  $input
  * @param InputDefinition $inputDefinition
  */
 private function setInputDefinition(Command $command, InputInterface $input, InputDefinition $inputDefinition)
 {
     $command->setDefinition($inputDefinition);
     $command->mergeApplicationDefinition();
     $input->bind($inputDefinition);
 }
開發者ID:bangpound,項目名稱:symfony-console-form,代碼行數:11,代碼來源:SetInputDefinitionOfFormBasedCommandEventListener.php


注:本文中的Symfony\Component\Console\Command\Command::setDefinition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。