當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。