本文整理汇总了PHP中Symfony\Component\Console\Application::doRunCommand方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::doRunCommand方法的具体用法?PHP Application::doRunCommand怎么用?PHP Application::doRunCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Application
的用法示例。
在下文中一共展示了Application::doRunCommand方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doRunCommand
/**
* @override
* @inheritDoc
*/
protected function doRunCommand(SymfonyCommand $command, InputInterface $input, OutputInterface $output)
{
if ($command instanceof CommandInterface && $command->isAsync() === true) {
$this->async = true;
}
return parent::doRunCommand($command, $input, $output);
}
示例2: doRunCommand
/**
* @inheritdoc
*/
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
{
if ($command->getName() != 'version') {
$output->writeln($this->getLongVersion());
}
return parent::doRunCommand($command, $input, $output);
}
示例3: 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);
}
示例4: doRunCommand
/**
* @param Command $command
* @param InputInterface $input
* @param OutputInterface $output
* @return int
* @throws \Exception
*/
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
{
if ($command instanceof FactoryAwareInterface) {
$command->setFactory($this->factory);
}
return parent::doRunCommand($command, $input, $output);
}
示例5: doRunCommand
/**
* {@inheritdoc}
*/
public function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
{
// Inject the kernel in to the command before we execute it.
if ($command instanceof CommandInterface) {
$command->setKernel($this->kernel);
}
return parent::doRunCommand($command, $input, $output);
}
示例6: doRunCommand
/**
* Runs the current command.
*
* If an event dispatcher has been attached to the application,
* events are also dispatched during the life-cycle of the command.
*
* @param SingletonCommand $command A Command instance
* @param InputInterface $input An Input instance
* @param OutputInterface $output An Output instance
*
* @return int 0 if everything went fine, or an error code
*
* @throws \Exception when the command being run threw an exception
*/
protected function doRunCommand(SingletonCommand $command, InputInterface $input, OutputInterface $output)
{
try {
$command->lock();
return parent::doRunCommand($command, $input, $output);
} catch (\Exception $e) {
$command->unlock();
}
}
示例7: doRunCommand
/**
* {@inheritdoc}
*/
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
{
if (!in_array($command->getName(), ['help', 'list'])) {
$output = new ConsoleOutput($output->getVerbosity(), $output->isDecorated(), $output->getFormatter());
}
if ($command instanceof \Cawa\Console\Command) {
$command->setInput($input);
$command->setOutput($output);
}
return parent::doRunCommand($command, $input, $output);
}
示例8: doRunCommand
protected function doRunCommand(BaseCommand $command, InputInterface $input, OutputInterface $output)
{
if (!$command instanceof Command) {
return parent::doRunCommand($command, $input, $output);
}
$run = array_merge($this->resolveDependencies($command), [$command]);
$exitCode = 0;
foreach ($run as $command) {
$output->writeln("Running {$command->getName()}...");
$exitCode = parent::doRunCommand($command, $input, $output);
}
return $exitCode;
}
示例9: doRunCommand
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
{
if ($input->hasParameterOption(['--log', '-l']) && $command instanceof \App\Command) {
$logPath = $input->getParameterOption(['--log', '-l']);
$logDir = realpath(dirname($logPath));
if (!$logDir) {
throw new \InvalidArgumentException(sprintf('Log folder does not exist! %s', $logDir));
}
$log = new Logger('depipe');
$log->pushHandler(new StreamHandler($logPath));
$command->setLogger($log);
$this->logger = $command;
}
parent::doRunCommand($command, $input, $output);
}
示例10: 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);
}
示例11: doRunCommand
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
{
$this->getHelperSet()->setCommand($command);
return parent::doRunCommand($command, $input, $output);
}
示例12: doRunCommand
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
{
if ($this->serviceLocator) {
$this->serviceLocator->callInjects($command);
}
return parent::doRunCommand($command, $input, $output);
}
示例13: doRunCommand
/**
* @override To limit access as root user
*/
public function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
{
if ($this->isRunByRoot() && !$this->isWhitelistedForRoot($command)) {
$output->writeln('<error>You are not allowed to run this command as root.</error>');
return ExitCode::EXIT_COMMAND_AS_ROOT_DENIED;
}
return parent::doRunCommand($command, $input, $output);
}
示例14: doRunCommand
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;
}
示例15: doRunCommand
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
{
$definition = $command->getDefinition();
$definition->addOption(new InputOption('gruver_file', 'g', InputOption::VALUE_OPTIONAL, 'Location of gruver.yml file'));
return parent::doRunCommand($command, $input, $output);
}