本文整理汇总了PHP中Symfony\Component\Console\Application::doRun方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::doRun方法的具体用法?PHP Application::doRun怎么用?PHP Application::doRun使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Application
的用法示例。
在下文中一共展示了Application::doRun方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doRun
public function doRun(InputInterface $input, OutputInterface $output)
{
$container = $this->container;
$container->set('ui.input', $input);
$container->set('ui.output', $output);
$container->get('logger.handler')->setOutput($output);
foreach ($container->getByPrefix('commands') as $command) {
$this->add($command);
}
if ($input->hasParameterOption(array('--tags', '-t'))) {
$tags = $input->getParameterOption(array('--tags', '-t'));
$tags = explode(',', $tags);
$container->setParameter('filter.tags', $tags);
$container->get('logger')->addDebug('Filtered using tags', array('tags' => $tags));
}
if ($input->hasParameterOption(array('--coverage', '-r'))) {
$container->setParameter('coverage.enabled', true);
}
$event = new GenericEvent($container);
$container->get('dispatcher')->dispatch(ApplicationEvents::initialize, $event);
$command = $this->getCommandName($input);
if (trim($command) === '') {
$input = new StringInput('start');
}
return parent::doRun($input, $output);
}
示例2: doRun
/**
* @inheritdoc
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
$this->loadServices();
$this->addServiceCommands();
$output->writeln(sprintf('<comment>%s</comment>', self::TITLE));
parent::doRun($input, $output);
}
示例3: doRun
public function doRun(InputInterface $input, OutputInterface $output)
{
$password = getenv('VAULT_PASSWORD');
$tries = 0;
while (!$password) {
$question = new Question('Vault password: ', null);
$question->setHidden(true);
$question->setHiddenFallback(false);
$helperSet = $this->getHelperSet();
$helper = $helperSet->get('question');
$password = $helper->ask($input, $output, $question);
}
$this->vault = new Vault($password, $output);
// Defaults
$this->vault->setStoragePath(getcwd() . '/vault');
$this->vault->setWorkPath(getcwd() . '/secure');
$this->vault->verify();
// Load droid.yml
$filename = $this->getVaultFilename();
if ($filename && file_exists($filename)) {
$loader = new JsonLoader();
$loader->load($vault, $filename);
} else {
}
return parent::doRun($input, $output);
}
示例4: doRun
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
$helperSet = $this->getHelperSet();
$this->container->set('console.input', $input);
$this->container->set('console.output', $output);
$this->container->setShared('console.prompter.factory', function ($c) use($helperSet) {
return new Factory($c->get('console.input'), $c->get('console.output'), $helperSet);
});
$this->container->setShared('process.executioncontext', function () {
return JsonExecutionContext::fromEnv($_SERVER);
});
$assembler = new ContainerAssembler();
$assembler->build($this->container);
$this->loadConfigurationFile($input, $this->container);
foreach ($this->container->getByPrefix('console.commands') as $command) {
$this->add($command);
}
$this->setDispatcher($this->container->get('console_event_dispatcher'));
$this->container->get('console.io')->setConsoleWidth($this->getTerminalWidth());
StreamWrapper::reset();
foreach ($this->container->getByPrefix('loader.resource_loader.spec_transformer') as $transformer) {
StreamWrapper::addTransformer($transformer);
}
StreamWrapper::register();
return parent::doRun($input, $output);
}
示例5: doRun
public function doRun(InputInterface $input, OutputInterface $output)
{
$this->io = new ConsoleIO($input, $output, $this->getHelperSet());
if (version_compare(PHP_VERSION, '5.3.2', '<')) {
$output->writeln('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP ' . PHP_VERSION . ', upgrading is strongly recommended.</warning>');
}
if (defined('COMPOSER_DEV_WARNING_TIME') && $this->getCommandName($input) !== 'self-update' && $this->getCommandName($input) !== 'selfupdate') {
if (time() > COMPOSER_DEV_WARNING_TIME) {
$output->writeln(sprintf('<warning>Warning: This development build of composer is over 30 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
}
}
if (getenv('COMPOSER_NO_INTERACTION')) {
$input->setInteractive(false);
}
if ($input->hasParameterOption('--profile')) {
$startTime = microtime(true);
$this->io->enableDebugging($startTime);
}
if ($newWorkDir = $this->getNewWorkingDir($input)) {
$oldWorkingDir = getcwd();
chdir($newWorkDir);
}
$result = parent::doRun($input, $output);
if (isset($oldWorkingDir)) {
chdir($oldWorkingDir);
}
if (isset($startTime)) {
$output->writeln('<info>Memory usage: ' . round(memory_get_usage() / 1024 / 1024, 2) . 'MB (peak: ' . round(memory_get_peak_usage() / 1024 / 1024, 2) . 'MB), time: ' . round(microtime(true) - $startTime, 2) . 's');
}
return $result;
}
示例6: doRun
public function doRun(InputInterface $input, OutputInterface $output)
{
if (extension_loaded('xdebug')) {
$output->writeln('<comment>You are running propel with xdebug enabled. This has a major impact on runtime performance.</comment>' . "\n");
}
return parent::doRun($input, $output);
}
示例7: doRun
public function doRun(InputInterface $input, OutputInterface $output)
{
if (!$this->logger) {
$this->logger = new ConsoleLogger($output);
}
parent::doRun($input, $output);
}
示例8: doRun
/**
* Runs the current application.
*
* Always show the version information except when the user invokes the help
* command as that already does it
*
* @param InputInterface $input An Input instance
* @param OutputInterface $output An Output instance
* @return integer 0 if everything went fine, or an error code otherwise
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
if ($this->showWelcomeMessage && $input->hasParameterOption(array('--help', '-h')) === false && $input->getFirstArgument() !== null) {
$output->writeln($this->getLongVersion());
$output->writeln('');
}
return parent::doRun($input, $output);
}
示例9: doRun
public function doRun(InputInterface $input, OutputInterface $output)
{
$output->writeln('Tombstone Analyzer ' . $this->getVersion());
if (!$input->getFirstArgument()) {
$input = new ArrayInput(array('--help'));
}
AbstractApplication::doRun($input, $output);
}
示例10: doRun
public function doRun(InputInterface $input, OutputInterface $output)
{
$this->registerCommands();
/** @var \Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher $eventDispatcher */
$eventDispatcher = $this->getContainer()->get('event_dispatcher');
$this->setDispatcher($eventDispatcher);
return parent::doRun($input, $output);
}
示例11: doRun
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
$this->config = $this->parseConfigurationFile($input);
$this->container = new ContainerBuilder();
$loader = new YamlFileLoader($this->container, new FileLocator(__DIR__ . '/../Resources'));
$loader->load('services.yml');
return parent::doRun($input, $output);
}
示例12: doRun
/**
* Runs the current application.
*
* @param InputInterface $input An Input instance
* @param OutputInterface $output An Output instance
*
* @return integer 0 if everything went fine, or an error code
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
if (!$this->commandsRegistered) {
$this->registerCommands();
$this->commandsRegistered = true;
}
return parent::doRun($input, $output);
}
示例13: doRun
/**
* {@inheritDoc}
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
$this->io = new ConsoleIO($input, $output, $this->getHelperSet());
if (version_compare(PHP_VERSION, '5.3.3', '<')) {
$output->writeln('<warning>Vaultage only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP ' . PHP_VERSION . ', upgrading is strongly recommended.</warning>');
}
return parent::doRun($input, $output);
}
示例14: doRun
/**
* Run the Peridot application
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
$command = $this->getPeridotCommand($output);
$this->add($command);
$exitCode = parent::doRun($input, $output);
$this->environment->getEventEmitter()->emit('peridot.end', $exitCode, $input, $output);
return $exitCode;
}
示例15: doRun
/**
* Runs the current application.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return int
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
$styles = Factory::createAdditionalStyles();
foreach ($styles as $name => $style) {
$output->getFormatter()->setStyle($name, $style);
}
$this->consoleIo = new ConsoleIO($input, $output, $this->getHelperSet());
return parent::doRun($input, $output);
}