当前位置: 首页>>代码示例>>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;未经允许,请勿转载。