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


PHP Command::getApplication方法代码示例

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


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

示例1: 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

示例2: 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

示例3: initApplication

 /**
  * @param  array                                  $modes
  * @return \Symfony\Component\Console\Application
  * @throws \Exception
  */
 public function initApplication($modes)
 {
     if (null === $modes) {
         throw new \Exception('A notification mode must be defined');
     }
     $app = parent::getApplication();
     foreach (explode(',', $modes) as $mode) {
         $app->registerEventListener(ucfirst($mode . 'Listener'));
     }
     $this->setApplication($app);
 }
开发者ID:wooshell,项目名称:gh-notifier,代码行数:16,代码来源:Send.php

示例4: executeConsole

 /**
  * @param Command  $command
  * @param string[] $arguments
  *
  * @return string
  */
 protected function executeConsole(Command $command, array $arguments = array())
 {
     if (!$command->getApplication()) {
         $command->setApplication(new Application($this->client->getKernel()));
     }
     if ($command instanceof ContainerAwareCommand) {
         $command->setContainer($this->client->getContainer());
     }
     $arguments = array_replace(array('--env' => 'test', 'command' => $command->getName()), $arguments);
     $commandTester = new CommandTester($command);
     $commandTester->execute($arguments);
     return $commandTester->getDisplay();
 }
开发者ID:BoShurik,项目名称:PayumBundle,代码行数:19,代码来源:DebugGatewayCommandTest.php

示例5: initialize

 /**
  * Initializes default command definitions
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  */
 protected final function initialize(InputInterface $input, OutputInterface $output)
 {
     // Set container and application.
     $this->application = parent::getApplication();
     $this->container = $this->application->getContainer();
     // Dispatch pre execute event.
     $dispatcher = $this->container->getServiceBag()->getDispatcher();
     $dispatcher->dispatch(Events::PRE_INITIALIZE, new PreInitializeEvent($this->container));
     // Initialize child class.
     $this->initializeCommand($input, $output);
     // Dispatch post execute event.
     $dispatcher->dispatch(Events::POST_INITIALIZE, new PostInitializeEvent($this->container));
 }
开发者ID:ebidtech,项目名称:console-application,代码行数:19,代码来源:BaseCommand.php

示例6: getApplication

 /**
  * @return \Drupal\Console\Application;
  */
 public function getApplication()
 {
     return parent::getApplication();
 }
开发者ID:mnico,项目名称:DrupalConsole,代码行数:7,代码来源:Command.php

示例7: getApplication

 /**
  * {@inheritdoc}
  */
 public function getApplication()
 {
     return $this->decoratedCommand->getApplication();
 }
开发者ID:frankdejonge,项目名称:locked-console-command,代码行数:7,代码来源:LockedCommandDecorator.php

示例8: getApplication

 public function getApplication()
 {
     return $this->innerCommand->getApplication();
 }
开发者ID:lolautruche,项目名称:ezsh,代码行数:4,代码来源:WrappedCommand.php

示例9: runById

 /**
  * Run a task by it's id, use the migration:report to see all the task and their id
  *
  * @\Nucleus\Bundle\ConsoleBundle\Command\CommandLine(name="nucleus_migration:runById")
  *
  * @param string $taskId The task id you want to run
  */
 public function runById($taskId, OutputInterface $output, Command $parentCommand)
 {
     if ($migrationTask = $this->loadTaskById($taskId)) {
         $this->runTask($migrationTask, $parentCommand->getApplication(), $output);
         $output->writeln('Task id [' . $taskId . '] has been run');
     } else {
         $output->writeln('Task id [' . $taskId . '] not found');
     }
 }
开发者ID:mpoiriert,项目名称:nucleus-migration-bundle,代码行数:16,代码来源:Coordinator.php


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