本文整理汇总了PHP中Symfony\Component\Console\Style\SymfonyStyle::title方法的典型用法代码示例。如果您正苦于以下问题:PHP SymfonyStyle::title方法的具体用法?PHP SymfonyStyle::title怎么用?PHP SymfonyStyle::title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Style\SymfonyStyle
的用法示例。
在下文中一共展示了SymfonyStyle::title方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
if (false !== strpos($input->getFirstArgument(), ':d')) {
$io->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)) {
$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), 10));
}
示例3: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->io->title($this->getDescription());
$allJournals = $this->getAllJournals();
$this->io->progressStart(count($allJournals));
foreach ($allJournals as $journal) {
$this->normalizeLastIssuesByJournal($journal);
}
}
示例4: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->io = new SymfonyStyle($input, $output);
$this->locale = $this->getContainer()->getParameter('locale');
$this->io->title('Import normalize translatable objects.');
$this->normalizeSubjects();
$this->normalizePublisherTypes();
$this->normalizePeriods();
}
示例5: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->io->title($this->getDescription());
foreach ($this->apiViews as $apiView) {
$bufferOutput = new BufferedOutput();
$this->application->run(new StringInput(sprintf('api:doc:dump --view=%s', $apiView)), $bufferOutput);
$viewDump = $bufferOutput->fetch();
$viewDumpFile = __DIR__ . '/../Resources/doc/' . $apiView . '-api-doc.md';
file_put_contents($viewDumpFile, $viewDump);
$this->io->writeln(sprintf("%s -> view dumped to %s", $apiView, $viewDumpFile));
}
}
示例6: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->io->title($this->getDescription());
$roles = explode(',', $input->getArgument('roles'));
if (!is_array($roles) || count($roles) < 1) {
throw new \LogicException('Specify min. 1 role');
}
$users = $this->em->getRepository('OjsUserBundle:User')->findUsersByJournalRole($roles);
$this->io->writeln('"user_id", "username", "first_name", "last_name", "email"');
/** @var User $user */
foreach ($users as $user) {
$this->io->writeln(sprintf('%s, "%s", "%s", "%s", "%s"', $user->getId(), $user->getUsername(), $user->getFirstName(), $user->getLastName(), $user->getEmail()));
}
}
示例7: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->io->title($this->getDescription());
$this->io->progressStart(count($this->allJournals));
$counter = 1;
foreach ($this->allJournals as $journal) {
$this->normalizeSetting($journal);
$this->io->progressAdvance(1);
$counter = $counter + 1;
if ($counter % 50 == 0) {
$this->em->flush();
}
}
$this->em->flush();
}
示例8: 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');
}
示例9: execute
/**
* Executes the command to
* - optionally update the reference index (to have clean data)
* - find files within uploads/* which are not connected to the reference index
* - remove these files if --dry-run is not set
*
* @param InputInterface $input
* @param OutputInterface $output
*
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->title($this->getDescription());
$dryRun = $input->hasOption('dry-run') && $input->getOption('dry-run') != false ? true : false;
$this->updateReferenceIndex($input, $io);
// Find the lost files
if ($input->hasOption('exclude') && !empty($input->getOption('exclude'))) {
$excludedPaths = GeneralUtility::trimExplode(',', $input->getOption('exclude'), true);
} else {
$excludedPaths = [];
}
$lostFiles = $this->findLostFiles($excludedPaths);
if (count($lostFiles)) {
if (!$io->isQuiet()) {
$io->note('Found ' . count($lostFiles) . ' lost files, ready to be deleted.');
if ($io->isVerbose()) {
$io->listing($lostFiles);
}
}
// Delete them
$this->deleteLostFiles($lostFiles, $dryRun, $io);
$io->success('Deleted ' . count($lostFiles) . ' lost files.');
} else {
$io->success('Nothing to do, no lost files found');
}
}
示例10: outputMailer
/**
* @throws \InvalidArgumentException When route does not exist
*/
protected function outputMailer($name)
{
try {
$service = sprintf('swiftmailer.mailer.%s', $name);
$mailer = $this->getContainer()->get($service);
} catch (ServiceNotFoundException $e) {
throw new \InvalidArgumentException(sprintf('The mailer "%s" does not exist.', $name));
}
$tableHeaders = array('Property', 'Value');
$tableRows = array();
$transport = $mailer->getTransport();
$spool = $this->getContainer()->getParameter(sprintf('swiftmailer.mailer.%s.spool.enabled', $name)) ? 'YES' : 'NO';
$delivery = $this->getContainer()->getParameter(sprintf('swiftmailer.mailer.%s.delivery.enabled', $name)) ? 'YES' : 'NO';
$singleAddress = $this->getContainer()->getParameter(sprintf('swiftmailer.mailer.%s.single_address', $name));
$this->io->title(sprintf('Configuration of the Mailer "%s"', $name));
if ($this->isDefaultMailer($name)) {
$this->io->comment('This is the default mailer');
}
$tableRows[] = array('Name', $name);
$tableRows[] = array('Service', $service);
$tableRows[] = array('Class', get_class($mailer));
$tableRows[] = array('Transport', sprintf('%s (%s)', sprintf('swiftmailer.mailer.%s.transport.name', $name), get_class($transport)));
$tableRows[] = array('Spool', $spool);
if ($this->getContainer()->hasParameter(sprintf('swiftmailer.spool.%s.file.path', $name))) {
$tableRows[] = array('Spool file', $this->getContainer()->getParameter(sprintf('swiftmailer.spool.%s.file.path', $name)));
}
$tableRows[] = array('Delivery', $delivery);
$tableRows[] = array('Single Address', $singleAddress);
$this->io->table($tableHeaders, $tableRows);
}
示例11: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->title('Pre-commit delete');
$git = new GitVersionControl();
$projectBase = $git->getProjectBase();
$hookDir = $projectBase . '/.git/hooks';
if (!$io->confirm('Are you sure to remove Pre-commit hooks on this project?', true)) {
exit(0);
}
$output->writeln('');
if (!is_dir($hookDir)) {
$io->error(sprintf('The git hook directory does not exist (%s)', $hookDir));
exit(1);
}
$target = $hookDir . '/pre-commit';
$fs = new Filesystem();
if (is_file($target)) {
$fs->remove($target);
$io->success('pre-commit was deleted');
exit(0);
}
$io->error(sprintf('pre-commit file does\'nt exist (%s)', $target));
exit(1);
}
示例12: execute
/**
* Execute the command.
*
* @param InputInterface $input
* @param OutputInterface $output
*
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->output = $output;
$this->formatter = new SymfonyStyle($input, $output);
if (!$this->multiLanguageIsEnabled) {
$this->formatter->error(['site.multilanguage should be set to true in parameters.yml.', 'Warning: All your urls will change from example.com/page to example.com/[locale]/page']);
return;
}
$this->installedLocale = array_flip($this->settings->get('Core', 'languages'));
$this->interfaceLocale = array_flip($this->settings->get('Core', 'interface_languages'));
$this->enabledLocale = array_flip($this->settings->get('Core', 'active_languages'));
$this->redirectLocale = array_flip($this->settings->get('Core', 'redirect_languages'));
$this->defaultEnabledLocale = $this->settings->get('Core', 'default_language');
$this->defaultInterfaceLocale = $this->settings->get('Core', 'default_interface_language');
$this->output->writeln($this->formatter->title('Fork CMS locale enable'));
$this->showLocaleOverview();
$this->selectWorkingLocale();
if (!$this->askToInstall()) {
return;
}
$this->askToAddInterfaceLocale();
if ($this->askToMakeTheLocaleAccessibleToVisitors()) {
$this->askToEnableTheLocaleForRedirecting();
}
}
示例13: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->title('Check Pre-commit requirements');
$hasError = false;
$resultOkVal = '<fg=green>✔</>';
$resultNokVal = '<fg=red>✘</>';
$commands = ['Composer' => array('command' => 'composer', 'result' => $resultOkVal), 'xmllint' => array('command' => 'xmllint', 'result' => $resultOkVal), 'jsonlint' => array('command' => 'jsonlint', 'result' => $resultOkVal), 'eslint' => array('command' => 'eslint', 'result' => $resultOkVal), 'sass-convert' => array('command' => 'sass-convert', 'result' => $resultOkVal), 'scss-lint' => array('command' => 'scss-lint', 'result' => $resultOkVal), 'phpcpd' => array('command' => 'phpcpd', 'result' => $resultOkVal), 'php-cs-fixer' => array('command' => 'php-cs-fixer', 'result' => $resultOkVal), 'phpmd' => array('command' => 'phpmd', 'result' => $resultOkVal), 'phpcs' => array('command' => 'phpcs', 'result' => $resultOkVal), 'box' => array('command' => 'box', 'result' => $resultOkVal)];
foreach ($commands as $label => $command) {
if (!$this->checkCommand($label, $command['command'])) {
$commands[$label]['result'] = $resultNokVal;
$hasError = true;
}
}
// Check Php conf param phar.readonly
if (!ini_get('phar.readonly')) {
$commands['phar.readonly'] = array('result' => $resultOkVal);
} else {
$commands['phar.readonly'] = array('result' => 'not OK (set "phar.readonly = Off" on your php.ini)');
}
$headers = ['Command', 'check'];
$rows = [];
foreach ($commands as $label => $cmd) {
$rows[] = [$label, $cmd['result']];
}
$io->table($headers, $rows);
if (!$hasError) {
$io->success('All Requirements are OK');
} else {
$io->note('Please fix all requirements');
}
exit(0);
}
示例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
/**
* @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));
}