本文整理汇总了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);
}
示例2: add
/**
* @param Command $command
* @return Command
*/
public function add(Command $command)
{
if ($command instanceof AbstractPimpleCommand) {
$command->setContainer($this->container);
}
return parent::add($command);
}
示例3: setContext
public function setContext(Context $context)
{
parent::setContext($context);
if ($this->innerCommand instanceof ContainerAwareCommand) {
$this->innerCommand->setContainer($this->container);
}
}
示例4: add
/**
* @param Command $command
* @return Command
*/
public function add(Command $command)
{
if ($command instanceof ContainerAwareCommand) {
$command->setContainer($this->getContainer());
}
return parent::add($command);
}
示例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);
}
示例6: add
/**
* {@inheritdoc}
*/
public function add(Command $command)
{
if ($command instanceof \Consoler\Command) {
$command->setContainer($this->container);
}
return parent::add($command);
}
示例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;
}
示例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);
}
示例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);
}
示例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());
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
}
示例15: add
public function add(SymfonyCommand $command)
{
if ($command instanceof Command) {
$command->setContainer($this->container);
}
return parent::add($command);
}