当前位置: 首页>>代码示例>>PHP>>正文


PHP Command\Command类代码示例

本文整理汇总了PHP中Symfony\Component\Console\Command\Command的典型用法代码示例。如果您正苦于以下问题:PHP Command类的具体用法?PHP Command怎么用?PHP Command使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Command类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: configure

 /**
  * {@inheritdoc}
  */
 public function configure(Command $command)
 {
     $locatorsExamples = implode(PHP_EOL, array_map(function ($locator) {
         return '- ' . $locator;
     }, $this->specificationFinder->getExampleLocators()));
     $command->addArgument('paths', InputArgument::OPTIONAL, 'Optional path(s) to execute. Could be:' . PHP_EOL . $locatorsExamples)->addOption('--dry-run', null, InputOption::VALUE_NONE, 'Invokes formatters without executing the tests and hooks.');
 }
开发者ID:OverByThere,项目名称:Behat,代码行数:10,代码来源:ExerciseController.php

示例2: execute

 public function execute()
 {
     $go = $this->getGo();
     if (!$go) {
         return $this->vars;
     }
     list($loopVarName, $loopCount) = $this->getLoopCount();
     if ($loopCount) {
         foreach ($loopCount as $loopVarValue) {
             $commandString = is_array($this->value) ? $this->value['value'] : $this->value;
             $commandArgs = explode(' ', $commandString);
             $replacedArrayArgs = array_map(function ($commandArg) use($loopVarName, $loopVarValue) {
                 return $this->replaceVarsInString($commandArg, [$loopVarName => $loopVarValue]);
             }, $commandArgs);
             $subCommand = $this->command->getApplication()->find(reset($commandArgs));
             $subCommand->run(new StringInput(implode(' ', $replacedArrayArgs)), $this->output);
         }
     } else {
         $commandString = is_array($this->value) ? $this->value['value'] : $this->value;
         $commandArgs = explode(' ', $commandString);
         $replacedArrayArgs = array_map([$this, 'replaceVarsInString'], $commandArgs);
         $subCommand = $this->command->getApplication()->find(reset($commandArgs));
         $subCommand->run(new StringInput(implode(' ', $replacedArrayArgs)), $this->output);
     }
     return $this->vars;
 }
开发者ID:lucatume,项目名称:codeception-setup-local,代码行数:26,代码来源:CommandInstruction.php

示例3: getDependencies

 /**
  * @param Command $command
  * @return array
  */
 public function getDependencies(Command $command)
 {
     if (!array_key_exists($command->getName(), $this->commands)) {
         return [];
     }
     return array_keys($this->commands[$command->getName()]);
 }
开发者ID:sergeyz,项目名称:cc,代码行数:11,代码来源:ChainCommandRegistry.php

示例4: assert

 /**
  * @param $condition
  * @param $message
  */
 private function assert($condition, $message)
 {
     if ($condition) {
         return;
     }
     throw new RuntimeException(sprintf('Command %s is not available because %s.', $this->command->getName(), $message));
 }
开发者ID:netz98,项目名称:n98-magerun,代码行数:11,代码来源:Enabler.php

示例5: add

 /**
  * @param  Command $command
  * @return Command
  */
 public function add(Command $command)
 {
     if ($command instanceof AbstractPimpleCommand) {
         $command->setContainer($this->container);
     }
     return parent::add($command);
 }
开发者ID:saxulum,项目名称:saxulum-console,代码行数:11,代码来源:ConsoleApplication.php

示例6: add

 /**
  * Add a command to the console.
  *
  * @param  \Symfony\Component\Console\Command\Command  $command
  * @return \Symfony\Component\Console\Command\Command
  */
 public function add(SymfonyCommand $command)
 {
     if ($command instanceof Command) {
         $command->setLaravel($this->laravel);
     }
     return $this->addToParent($command);
 }
开发者ID:janhartigan,项目名称:framework,代码行数:13,代码来源:Application.php

示例7: simulateHelperSet

 public function simulateHelperSet(Command $command)
 {
     $this->dialog = $this->getMock("Symfony\\Component\\Console\\Helper\\DialogHelper");
     $helpers = array('dialog' => $this->dialog);
     $helperSet = new HelperSet($helpers);
     $command->setHelperSet($helperSet);
 }
开发者ID:bonndan,项目名称:release-flow,代码行数:7,代码来源:CommandTest.php

示例8: add

 /**
  * Add a command to the console.
  *
  * @param  BaseCommand $command
  * @return BaseCommand
  */
 public function add(BaseCommand $command)
 {
     if ($command instanceof Command) {
         $command->setPagekit($this->pagekit);
     }
     return parent::add($command);
 }
开发者ID:enyaku,项目名称:myGoogleMapsApiV3Test,代码行数:13,代码来源:Application.php

示例9: addOptionsToCommand

 /**
  * @param Command $command
  * @param InputInterface $input
  */
 protected function addOptionsToCommand(Command $command, InputInterface $input)
 {
     $inputDefinition = $command->getApplication()->getDefinition();
     $inputDefinition->addOption(new InputOption(self::DISABLE_OPTIONAL_LISTENERS, null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, sprintf('Disable optional listeners, "%s" to disable all listeners, ' . 'command "%s" shows all listeners', self::ALL_OPTIONAL_LISTENERS_VALUE, OptionalListenersCommand::NAME)));
     $command->mergeApplicationDefinition();
     $input->bind($command->getDefinition());
 }
开发者ID:Maksold,项目名称:platform,代码行数:11,代码来源:OptionalListenersListener.php

示例10: stripOptions

 /**
  * Strip a command's options from an argv array.
  *
  * @param string[] $args
  * @param Command  $command
  *
  * @return string[]
  */
 protected function stripOptions(array $args, Command $command)
 {
     $definition = $command->getDefinition();
     foreach ($args as $key => $arg) {
         // Only consider options.
         if ($arg[0] !== '-') {
             continue;
         }
         // Look up the option. If it exists in the command definition,
         // remove it from the $args array.
         $argAsOption = preg_replace('/^\\-+([^=]+).*/', '$1', $arg);
         if ($definition->hasOption($argAsOption)) {
             $option = $definition->getOption($argAsOption);
         } else {
             try {
                 $option = $definition->getOptionForShortcut($argAsOption);
             } catch (\InvalidArgumentException $e) {
                 continue;
             }
         }
         // Unset the option.
         unset($args[$key]);
         // Unset the option's value too.
         if ($option->acceptValue() && isset($args[$key + 1]) && !strpos($arg, '=') && $args[$key + 1][0] !== '-') {
             unset($args[$key + 1]);
         }
     }
     return $args;
 }
开发者ID:drewmelck,项目名称:platformsh-cli,代码行数:37,代码来源:ArgvHelper.php

示例11: add

 /**
  * @param Command $command
  * @return Command
  */
 public function add(Command $command)
 {
     if ($command instanceof ContainerAwareInterface) {
         $command->setContainer($this->container);
     }
     return parent::add($command);
 }
开发者ID:bcncommerce,项目名称:console,代码行数:11,代码来源:Application.php

示例12: doRunCommand

 /**
  * @override
  * @inheritDoc
  */
 protected function doRunCommand(SymfonyCommand $command, InputInterface $input, OutputInterface $output)
 {
     if ($command instanceof CommandInterface && $command->isAsync() === true) {
         $this->async = true;
     }
     return parent::doRunCommand($command, $input, $output);
 }
开发者ID:kraken-php,项目名称:framework,代码行数:11,代码来源:CommandManager.php

示例13: add

 /**
  * Add command
  *
  * @param SymfonyCommand $command
  * @return SymfonyCommand
  */
 public function add(SymfonyCommand $command)
 {
     if ($command instanceof Command) {
         $command->setConfig($this->config)->setLog($this->log);
     }
     return parent::add($command);
 }
开发者ID:Hiroto-K,项目名称:Tw-Cron,代码行数:13,代码来源:Application.php

示例14: doRunCommand

 /**
  * @param Command $command
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int
  * @throws \Exception
  */
 protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
 {
     if ($command instanceof FactoryAwareInterface) {
         $command->setFactory($this->factory);
     }
     return parent::doRunCommand($command, $input, $output);
 }
开发者ID:TYPO3,项目名称:Surf,代码行数:14,代码来源:ConsoleApplication.php

示例15: containerize_command

/**
 * @param Container $container
 * @param SymfonyCommand $command
 * @return Command|SymfonyCommand
 */
function containerize_command(Container $container, SymfonyCommand $command)
{
    if ($command instanceof Command) {
        $command->setContainer($container);
    }
    return $command;
}
开发者ID:monii,项目名称:nimble-symfony-console,代码行数:12,代码来源:functions.php


注:本文中的Symfony\Component\Console\Command\Command类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。