本文整理汇总了PHP中Symfony\Component\Console\Style\SymfonyStyle::newLine方法的典型用法代码示例。如果您正苦于以下问题:PHP SymfonyStyle::newLine方法的具体用法?PHP SymfonyStyle::newLine怎么用?PHP SymfonyStyle::newLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Style\SymfonyStyle
的用法示例。
在下文中一共展示了SymfonyStyle::newLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$show_installed = !$input->getOption('available');
$installed = $available = array();
foreach ($this->load_migrations() as $name) {
if ($this->migrator->migration_state($name) !== false) {
$installed[] = $name;
} else {
$available[] = $name;
}
}
if ($show_installed) {
$io->section($this->user->lang('CLI_MIGRATIONS_INSTALLED'));
if (!empty($installed)) {
$io->listing($installed);
} else {
$io->text($this->user->lang('CLI_MIGRATIONS_EMPTY'));
$io->newLine();
}
}
$io->section($this->user->lang('CLI_MIGRATIONS_AVAILABLE'));
if (!empty($available)) {
$io->listing($available);
} else {
$io->text($this->user->lang('CLI_MIGRATIONS_EMPTY'));
$io->newLine();
}
}
示例2: writeErrorReports
public function writeErrorReports(array $errorReports)
{
foreach ($errorReports as $file => $errors) {
$this->symfonyStyle->section('FILE: ' . $file);
$tableRows = $this->formatErrorsToTableRows($errors);
$this->symfonyStyle->table(['Line', 'Error', 'Sniff Code', 'Fixable'], $tableRows);
$this->symfonyStyle->newLine();
}
}
示例3: executeLocked
/**
* {@inheritdoc}
*/
protected function executeLocked(InputInterface $input, OutputInterface $output)
{
$this->io = new SymfonyStyle($input, $output);
$this->rootDir = dirname($this->getContainer()->getParameter('kernel.root_dir'));
$this->generateSymlinks();
if (!empty($this->rows)) {
$this->io->newLine();
$this->io->table(['', 'Symlink', 'Target / Error'], $this->rows);
}
return 0;
}
示例4: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$basePath = Application::basePath();
chdir($basePath);
$host = $input->getOption('host');
$port = $input->getOption('port');
$base = ProcessUtils::escapeArgument($basePath);
$binary = ProcessUtils::escapeArgument((new PhpExecutableFinder())->find(false));
$io = new SymfonyStyle($input, $output);
$io->newLine();
$io->writeln('<info>Tagmeo development server started on http://' . $host . ':' . $port . '/</info>');
$io->newLine();
passthru($binary . ' -S ' . $host . ':' . $port . ' ' . $base . '/server.php');
}
示例5: executeLocked
/**
* {@inheritdoc}
*/
protected function executeLocked(InputInterface $input, OutputInterface $output)
{
$this->fs = new Filesystem();
$this->io = new SymfonyStyle($input, $output);
$this->rootDir = dirname($this->getContainer()->getParameter('kernel.root_dir'));
$this->addEmptyDirs();
$this->addIgnoredDirs();
if (!empty($this->rows)) {
$this->io->newLine();
$this->io->listing($this->rows);
}
$this->addInitializePhp();
return 0;
}
示例6: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->io->title($this->getDescription());
$this->io->text("removing articles\n");
$this->removeArticles();
$this->io->newLine(2);
$this->io->text("refresh journal and remove issues\n");
$this->removeIssues($input);
$this->io->newLine(1);
$this->io->text("refresh journal and remove journal totally");
$this->refreshJournal($input);
$this->em->remove($this->journal);
$this->em->flush();
$this->io->success('successfully removed journal');
}
示例7: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->title('Import sentry events');
$organisation = $input->getArgument('organisation');
$project = $input->getArgument('project');
$projectBlacklist = $input->getOption('project-blacklist');
$sentryRequest = new SentryRequest($input->getOption('sentry-url'), $input->getOption('sentry-api-key'));
$projects = [$project];
if (null === $project) {
$projects = $this->application['project.collector']->getSlugs($sentryRequest, $organisation);
}
$progress = new ProgressBar($output);
$progress->start();
foreach ($projects as $project) {
if (in_array($project, $projectBlacklist)) {
continue;
}
$simplifiedEvents = $this->application['event.collector']->getSimplifiedEvents($sentryRequest, $organisation, $project);
foreach ($simplifiedEvents as $simplifiedEvent) {
$this->application['importer']->import($organisation, $project, $simplifiedEvent);
$progress->advance();
}
}
$progress->finish();
$io->newLine(2);
$eventCount = $this->application['db']->fetchColumn('SELECT COUNT(*) FROM events');
$io->success(sprintf('%s events are available.', $eventCount));
}
示例8: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->io->title($this->getDescription());
$this->io->text('Issue Total View Normalize Started');
$this->normalizeIssueTotalArticleView();
$this->io->text('Issue Total Download Normalize Started');
$this->normalizeIssueTotalArticleDownload();
$this->io->newLine();
$this->io->text('Journal Normalize Started');
$this->normalizeJournalTotalArticleView();
$this->io->text('Journal Total View Normalize Finished');
$this->normalizeJournalTotalArticleDownload();
$this->io->text('Journal Total Download Normalize Finished');
$this->io->newLine(2);
$this->io->success('All process finished');
}
示例9: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->title('Exporting databases');
$io->section('Exporting all databases');
$strategies = $this->collectorDbStrategy->collectDatabasesStrategies();
$totalStrategies = count($strategies);
$io->writeln($totalStrategies . ' strategie(s) found.');
$progressBar = new ProgressBar($output, $totalStrategies);
$progressBar->setFormat(self::PROGRESS_BAR_FORMAT);
$progressBar->setMessage('Beginning backuping');
$this->eventDispatcher->dispatch(Events::BACKUP_BEGINS, new BackupBeginsEvent($output));
$progressBar->start();
$reportContent = new \ArrayObject();
foreach ($strategies as $strategy) {
$strategyIdentifier = $strategy->getIdentifier();
$setProgressBarMessage = function ($message) use($progressBar, $strategyIdentifier) {
$message = "[{$strategyIdentifier}] {$message}";
$progressBar->setMessage($message);
$progressBar->display();
};
$exportedFiles = $this->processorDatabaseDumper->dump($strategy, $setProgressBarMessage);
$reportContent->append("Backuping of the database: {$strategyIdentifier}");
foreach ($exportedFiles as $file) {
$filename = $file->getPath();
$reportContent->append("\t→ {$filename}");
}
$progressBar->advance();
}
$progressBar->finish();
$io->newLine(2);
$io->section('Report');
$io->text($reportContent->getArrayCopy());
$this->eventDispatcher->dispatch(Events::BACKUP_ENDS, new BackupEndsEvent($output));
}
示例10: create_progress_bar
/**
* Create a styled progress bar
*
* @param int $max Max value for the progress bar
* @param SymfonyStyle $io Symfony style output decorator
* @param OutputInterface $output The output stream, used to print messages
* @param bool $message Should we display message output under the progress bar?
* @return ProgressBar
*/
public function create_progress_bar($max, SymfonyStyle $io, OutputInterface $output, $message = false)
{
$progress = $io->createProgressBar($max);
if ($output->getVerbosity() === OutputInterface::VERBOSITY_VERBOSE) {
$progress->setFormat('<info>[%percent:3s%%]</info> %message%');
$progress->setOverwrite(false);
} else {
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE) {
$progress->setFormat('<info>[%current:s%/%max:s%]</info><comment>[%elapsed%/%estimated%][%memory%]</comment> %message%');
$progress->setOverwrite(false);
} else {
$io->newLine(2);
$progress->setFormat(" %current:s%/%max:s% %bar% %percent:3s%%\n" . " " . ($message ? '%message%' : ' ') . " %elapsed:6s%/%estimated:-6s% %memory:6s%\n");
$progress->setBarWidth(60);
}
}
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
$progress->setEmptyBarCharacter('░');
// light shade character \u2591
$progress->setProgressCharacter('');
$progress->setBarCharacter('▓');
// dark shade character \u2593
}
return $progress;
}
示例11: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$namespace = $input->getArgument('namespace');
/** @var RouteCollection $RouteCollection */
$RouteCollection = Service::get('kernel.routes');
$Routes = $RouteCollection->all();
$io = new SymfonyStyle($input, $output);
$io->newLine();
$rows = array();
/** @var Route $Route */
foreach ($Routes as $name => $Route) {
$path = $Route->getPath();
$local = $Route->getOption('_locale');
$controller = $Route->getDefault('controller');
$host = $Route->getHost();
$methods = implode(', ', $Route->getMethods());
$schemes = implode(', ', $Route->getSchemes());
$_requirements = $Route->getRequirements();
$requirements = null;
$name = $local ? str_replace("-{$local}", '', $name) : $name;
foreach ($_requirements as $var => $patt) {
$requirements .= "\"{$var}={$patt}\" ";
}
$requirements = $requirements ? rtrim($requirements, ',') : '';
$rows[] = array($name, $path, $local, $methods, $schemes);
}
$io->table(array('Name', 'Path', 'Local', 'Method', 'Scheme'), $rows);
$io->success('Se han mostrado las rutas del proyecto exitosamente.');
}
示例12: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$name = $input->getArgument('name');
if (empty($name)) {
$io->comment('Provide the name of a bundle as the first argument of this command to dump its configuration.');
$io->newLine();
$this->listBundles($output);
return;
}
$extension = $this->findExtension($name);
$container = $this->compileContainer();
$configs = $container->getExtensionConfig($extension->getAlias());
$configuration = $extension->getConfiguration($configs, $container);
$this->validateConfiguration($extension, $configuration);
$configs = $container->getParameterBag()->resolveValue($configs);
$processor = new Processor();
$config = $processor->processConfiguration($configuration, $configs);
if ($name === $extension->getAlias()) {
$io->title(sprintf('Current configuration for extension with alias "%s"', $name));
} else {
$io->title(sprintf('Current configuration for "%s"', $name));
}
$io->writeln(Yaml::dump(array($extension->getAlias() => $config), 3));
}
示例13: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$output = new SymfonyStyle($input, $output);
if (false !== strpos($input->getFirstArgument(), ':d')) {
$output->caution('The use of "config:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:config" instead.');
}
$name = $input->getArgument('name');
if (empty($name)) {
$output->comment('Provide the name of a bundle as the first argument of this command to dump its configuration.');
$output->newLine();
$this->listBundles($output);
return;
}
$extension = $this->findExtension($name);
$container = $this->compileContainer();
$configs = $container->getExtensionConfig($extension->getAlias());
$configuration = $extension->getConfiguration($configs, $container);
$this->validateConfiguration($extension, $configuration);
$configs = $container->getParameterBag()->resolveValue($configs);
$processor = new Processor();
$config = $processor->processConfiguration($configuration, $configs);
if ($name === $extension->getAlias()) {
$output->title(sprintf('Current configuration for extension with alias "%s"', $name));
} else {
$output->title(sprintf('Current configuration for "%s"', $name));
}
$output->writeln(Yaml::dump(array($extension->getAlias() => $config), 3));
}
示例14: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->migrationPath = str_replace('/', DIRECTORY_SEPARATOR, $this->getContainer()->getParameter('campaignchain_update.bundle.schema_dir'));
$io = new SymfonyStyle($input, $output);
$io->title('Gathering migration files from CampaignChain packages');
$io->newLine();
$locator = $this->getContainer()->get('campaignchain.core.module.locator');
$bundleList = $locator->getAvailableBundles();
if (empty($bundleList)) {
$io->error('No CampaignChain Module found');
return;
}
$migrationsDir = $this->getContainer()->getParameter('doctrine_migrations.dir_name');
$fs = new Filesystem();
$table = [];
foreach ($bundleList as $bundle) {
$packageSchemaDir = $this->getContainer()->getParameter('kernel.root_dir') . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . $bundle->getName() . $this->migrationPath;
if (!$fs->exists($packageSchemaDir)) {
continue;
}
$migrationFiles = new Finder();
$migrationFiles->files()->in($packageSchemaDir)->name('Version*.php');
$files = [];
/** @var SplFileInfo $migrationFile */
foreach ($migrationFiles as $migrationFile) {
$fs->copy($migrationFile->getPathname(), $migrationsDir . DIRECTORY_SEPARATOR . $migrationFile->getFilename(), true);
$files[] = $migrationFile->getFilename();
}
$table[] = [$bundle->getName(), implode(', ', $files)];
}
$io->table(['Module', 'Versions'], $table);
if (!$input->getOption('gather-only')) {
$this->getApplication()->run(new ArrayInput(['command' => 'doctrine:migrations:migrate', '--no-interaction' => true]), $output);
}
}
示例15: execute
/**
* {@inheritdoc}
*
* @throws \LogicException
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$name = $input->getArgument('name');
if (empty($name)) {
$io->comment('Provide the name of a bundle as the first argument of this command to dump its default configuration.');
$io->newLine();
$this->listBundles($output);
return;
}
$extension = $this->findExtension($name);
$configuration = $extension->getConfiguration(array(), $this->getContainerBuilder());
$this->validateConfiguration($extension, $configuration);
if ($name === $extension->getAlias()) {
$message = sprintf('Default configuration for extension with alias: "%s"', $name);
} else {
$message = sprintf('Default configuration for "%s"', $name);
}
switch ($input->getOption('format')) {
case 'yaml':
$io->writeln(sprintf('# %s', $message));
$dumper = new YamlReferenceDumper();
break;
case 'xml':
$io->writeln(sprintf('<!-- %s -->', $message));
$dumper = new XmlReferenceDumper();
break;
default:
$io->writeln($message);
throw new \InvalidArgumentException('Only the yaml and xml formats are supported.');
}
$io->writeln($dumper->dump($configuration, $extension->getNamespace()));
}