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


PHP Command::setContainer方法代码示例

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


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

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

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

示例3: setContext

 public function setContext(Context $context)
 {
     parent::setContext($context);
     if ($this->innerCommand instanceof ContainerAwareCommand) {
         $this->innerCommand->setContainer($this->container);
     }
 }
开发者ID:lolautruche,项目名称:ezsh,代码行数:7,代码来源:WrappedCommand.php

示例4: add

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

示例5: doRunCommand

 /**
  * Pass the container to Container Aware Command classes
  *
  * @param Command $command
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return mixed
  */
 protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
 {
     if ($command instanceof ContainerAwareInterface) {
         $command->setContainer($this->getContainer());
     }
     return parent::doRunCommand($command, $input, $output);
 }
开发者ID:tests-always-included,项目名称:symfony-console-bootstrap,代码行数:15,代码来源:Application.php

示例6: add

 /**
  * {@inheritdoc}
  */
 public function add(Command $command)
 {
     if ($command instanceof \Consoler\Command) {
         $command->setContainer($this->container);
     }
     return parent::add($command);
 }
开发者ID:vaibhavpandeyvpz,项目名称:consoler,代码行数:10,代码来源:Application.php

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

示例8: add

 /**
  * Adds a command object.
  *
  * If a command with the same name already exists, it will be overridden.
  *
  * @param Command $command A Command object
  *
  * @return Command The registered command
  *
  * @api
  */
 public function add(SymfonyCommand $command)
 {
     // make the container accessible to the commands
     $command->setContainer($this->app);
     // Bind the command into the container
     $this->app->instance($command->getKey(), $command);
     return parent::add($command);
 }
开发者ID:singularity321,项目名称:Arty,代码行数:19,代码来源:Application.php

示例9: add

 /**
  * {inheritDoc}
  */
 public function add(SymfonyCommand $command)
 {
     // Inject the service container if the command knows how to use it
     if ($command instanceof ContainerAwareInterface) {
         $command->setContainer($this->_container);
     }
     parent::add($command);
 }
开发者ID:mothership-ec,项目名称:cog,代码行数:11,代码来源:Application.php

示例10: executeCommand

 private function executeCommand(Command $command, Input $input)
 {
     $command->setApplication($this->application);
     $input->setInteractive(false);
     if ($command instanceof ContainerAwareCommand) {
         $command->setContainer($this->client->getContainer());
     }
     $command->run($input, new NullOutput());
 }
开发者ID:ajouve,项目名称:doctrine-fixtures-test,代码行数:9,代码来源:FixtureTestCase.php

示例11: add

 public function add(Command $command)
 {
     if (!$command instanceof SupraCommand && !$command instanceof ContainerAware && !($command instanceof ListCommand || $command instanceof HelpCommand)) {
         throw new \InvalidArgumentException('All commands must extend Supra\\Core\\Console\\AbstractCommand (or implement Supra\\Core\\DependencyInjection\\ContainerAware)');
     }
     if ($command instanceof ContainerAware) {
         $command->setContainer($this->container);
     }
     parent::add($command);
 }
开发者ID:sitesupra,项目名称:sitesupra,代码行数:10,代码来源:Application.php

示例12: executeConsole

 /**
  * @param Command  $command
  * @param string[] $arguments
  *
  * @return string
  */
 protected function executeConsole(Command $command, array $arguments = array())
 {
     $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:MHaendel,项目名称:PayumBundle,代码行数:17,代码来源:CreateCaptureTokenCommandTest.php

示例13: doRunCommand

 /**
  * {@inheritDoc}
  */
 public function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
 {
     if ($command instanceof ContainerAwareInterface) {
         $container = $this->buildContainer($input);
         $command->setContainer($container);
     }
     return parent::doRunCommand($command, $input, $output);
 }
开发者ID:behcetenuygun,项目名称:cachetool,代码行数:11,代码来源:Application.php

示例14: add

 /**
  * Wrap the add method and do not register commands which are unsupported by
  * the current transport.
  *
  * {@inheritDoc}
  */
 public function add(Command $command)
 {
     if ($command instanceof ContainerAwareInterface) {
         $command->setContainer($this->container);
     }
     if ($command instanceof BasePhpcrCommand) {
         if ($this->showUnsupported || $command->isSupported()) {
             parent::add($command);
         }
     } else {
         parent::add($command);
     }
 }
开发者ID:hason,项目名称:phpcr-shell,代码行数:19,代码来源:ShellApplication.php

示例15: add

 public function add(SymfonyCommand $command)
 {
     if ($command instanceof Command) {
         $command->setContainer($this->container);
     }
     return parent::add($command);
 }
开发者ID:yusukezzz,项目名称:consolet,代码行数:7,代码来源:Application.php


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