/** * @param Command $command * @return Command */ public function add(Command $command) { if ($command instanceof ContainerAwareInterface) { $command->setContainer($this->container); } return parent::add($command); }
/** * @param Command $command * @return Command */ public function add(Command $command) { if ($command instanceof AbstractPimpleCommand) { $command->setContainer($this->container); } return parent::add($command); }
public function setContext(Context $context) { parent::setContext($context); if ($this->innerCommand instanceof ContainerAwareCommand) { $this->innerCommand->setContainer($this->container); } }
/** * @param Command $command * @return Command */ public function add(Command $command) { if ($command instanceof ContainerAwareCommand) { $command->setContainer($this->getContainer()); } return parent::add($command); }
/** * 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); }
/** * {@inheritdoc} */ public function add(Command $command) { if ($command instanceof \Consoler\Command) { $command->setContainer($this->container); } return parent::add($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; }
/** * 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); }
/** * {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); }
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()); }
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); }
/** * @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(); }
/** * {@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); }
/** * 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); } }
public function add(SymfonyCommand $command) { if ($command instanceof Command) { $command->setContainer($this->container); } return parent::add($command); }
/** * Add a command to the console. * * @param \Symfony\Component\Console\Command\Command $command * * @return null|\Symfony\Component\Console\Command\Command */ public function add(SymfonyCommand $command) { if ($command instanceof ViserioCommand) { $command->setContainer($this->getContainer()); $command->setInvoker($this->getInvoker()); } return parent::add($command); }
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output) { if ($command instanceof \Owncloud\Updater\Command\Command) { $command->setContainer($this->getContainer()); $commandName = $this->getCommandName($input); $this->getLogger()->info('Execution of ' . $commandName . ' command started'); if (!empty($command->getMessage())) { $message = sprintf('<info>%s</info>', $command->getMessage()); $output->writeln($message); } $exitCode = parent::doRunCommand($command, $input, $output); $this->getLogger()->info('Execution of ' . $commandName . ' command stopped. Exit code is ' . $exitCode); } else { $exitCode = parent::doRunCommand($command, $input, $output); } return $exitCode; }
/** * @param $command * @param $worker */ private function executeCommand(Command $command, $worker) { $executor = new JobExecutor(); $container = new Container(); $container->set('worker', $worker); $container->set('mcfedr_queue_manager.job_executor', $executor); $command->setContainer($container); $executor->setContainer($container); $application = new Application(); $application->add($command); $command = $application->find('mcfedr:queue:default-runner'); $commandTester = new CommandTester($command); $commandTester->execute(['command' => $command->getName(), '--limit' => 1]); }