本文整理汇总了PHP中Symfony\Component\Console\Style\SymfonyStyle::section方法的典型用法代码示例。如果您正苦于以下问题:PHP SymfonyStyle::section方法的具体用法?PHP SymfonyStyle::section怎么用?PHP SymfonyStyle::section使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Style\SymfonyStyle
的用法示例。
在下文中一共展示了SymfonyStyle::section方法的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: 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));
}
示例3: 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();
}
}
示例4: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
// throw new \Exception('boo');
$directory = realpath($input->getArgument('directory'));
$directoryOutput = $input->getArgument('outputdirectory');
/* @var $logger Psr\Log\LoggerInterface */
$this->logger = $this->getContainer()->get('logger');
$io = new SymfonyStyle($input, $output);
$io->title('DDD Model Generation');
$clean = $input->hasOption('clean');
if ($clean) {
$io->section('Clean output directoty');
$fs = new \Symfony\Component\Filesystem\Filesystem();
try {
$fs->remove($directoryOutput);
} catch (IOExceptionInterface $e) {
$io->error($e->getMessage());
}
$io->text('clean of ' . $directoryOutput . ' completed');
}
if (is_dir($directory)) {
$finder = new Finder();
$finder->search($directory);
foreach ($finder->getFindedFiles() as $file) {
if (pathinfo($file, PATHINFO_FILENAME) == 'model.yml') {
$io->text('Analizzo model.yml in ' . pathinfo($file, PATHINFO_DIRNAME));
$dddGenerator = new DDDGenerator();
$dddGenerator->setLogger($this->logger);
$dddGenerator->analyze($file);
$dddGenerator->generate($directoryOutput);
}
}
$io->section('Php-Cs-Fixer on generated files');
$fixer = new \Symfony\CS\Console\Command\FixCommand();
$input = new ArrayInput(['path' => $directoryOutput, '--level' => 'psr2', '--fixers' => 'eof_ending,strict_param,short_array_syntax,trailing_spaces,indentation,line_after_namespace,php_closing_tag']);
$output = new BufferedOutput();
$fixer->run($input, $output);
$content = $output->fetch();
$io->text($content);
if (count($this->errors) == 0) {
$io->success('Completed generation');
} else {
$io->error($this->errors);
}
} else {
$io->caution('Directory ' . $directory . ' not valid');
}
// PER I WARNING RECUPERABILI
//$io->note('Generate Class');
}
示例5: startMailEventSync
/**
* @param EventDetail $eventOption
*/
private function startMailEventSync(EventDetail $eventOption)
{
$this->io->section(sprintf('Started event sync for -> %s -> %s', $eventOption->getName(), $eventOption->getGroup()));
foreach ($this->langs as $lang) {
if ($eventOption->getGroup() == 'journal') {
if (!$this->checkMailTemplateExists($eventOption, $lang, null, true, false)) {
$this->createMailTemplateSkeleton($eventOption, $lang, null, true, false);
}
foreach ($this->allJournals as $journal) {
if (!$this->checkMailTemplateExists($eventOption, $lang, $journal, false, true)) {
$this->createMailTemplateSkeleton($eventOption, $lang, $journal, false, true, false);
}
}
} else {
if ($eventOption->getGroup() == 'admin') {
if (!$this->checkMailTemplateExists($eventOption, $lang, null, false, false)) {
$this->createMailTemplateSkeleton($eventOption, $lang, null, false, false);
}
}
}
if ($this->syncDescriptions) {
$this->syncEventDescription($eventOption, $lang);
}
$this->em->flush();
}
}
示例6: updateCode
/**
* @param SymfonyStyle|null $io
*/
public function updateCode(SymfonyStyle $io = null)
{
$io->title('CampaignChain Data Update');
if (empty($this->versions)) {
$io->warning('No code updater Service found, maybe you didn\'t enable a bundle?');
return;
}
$io->comment('The following data versions will be updated');
$migratedVersions = array_map(function (DataUpdateVersion $version) {
return $version->getVersion();
}, $this->em->getRepository('CampaignChainUpdateBundle:DataUpdateVersion')->findAll());
$updated = false;
foreach ($this->versions as $version => $class) {
if (in_array($version, $migratedVersions)) {
continue;
}
$io->section('Version ' . $class->getVersion());
$io->listing($class->getDescription());
$io->text('Begin data update');
$result = $class->execute($io);
if ($result) {
$dbVersion = new DataUpdateVersion();
$dbVersion->setVersion($version);
$this->em->persist($dbVersion);
$this->em->flush();
$io->text('Data update finished');
}
$updated = true;
}
if (!$updated) {
$io->success('All data is up to date.');
} else {
$io->success('Every data version has been updated.');
}
}
示例7: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$entityManager = $this->getContainer()->get('doctrine.orm.entity_manager');
$groupRepository = $entityManager->getRepository('OctavaAdministratorBundle:Group');
$resourceRepository = $entityManager->getRepository('OctavaAdministratorBundle:Resource');
$groupNames = $input->getOption('group');
foreach ($groupNames as $groupName) {
/** @var Group $group */
$group = $groupRepository->findOneBy(['name' => $groupName]);
if (!$group) {
$io->error(sprintf('Group "%s" not found', $groupName));
continue;
}
$rows = [];
$existsResources = $group->getResources();
/** @var \Octava\Bundle\AdministratorBundle\Entity\Resource $resource */
foreach ($resourceRepository->findAll() as $resource) {
if ($existsResources->contains($resource)) {
continue;
}
$group->addResource($resource);
$rows[] = [$resource->getResource(), $resource->getAction()];
}
if ($rows) {
$io->section($groupName);
$headers = ['Resource', 'Action'];
$io->table($headers, $rows);
$entityManager->persist($group);
$entityManager->flush();
}
}
}
示例8: reparse
/**
* Reparse all text handled by given reparser within given range
*
* @param string $name Reparser name
*/
protected function reparse($name)
{
$reparser = $this->reparsers[$name];
if ($this->input->getOption('dry-run')) {
$reparser->disable_save();
} else {
$reparser->enable_save();
}
// Start at range-max if specified or at the highest ID otherwise
$max = $this->get_option($name, 'range-max');
$min = $this->get_option($name, 'range-min');
$size = $this->get_option($name, 'range-size');
if ($max < $min) {
return;
}
$this->io->section($this->user->lang('CLI_REPARSER_REPARSE_REPARSING', preg_replace('(^text_reparser\\.)', '', $name), $min, $max));
$progress = $this->create_progress_bar($max);
$progress->setMessage($this->user->lang('CLI_REPARSER_REPARSE_REPARSING_START', preg_replace('(^text_reparser\\.)', '', $name)));
$progress->start();
// Start from $max and decrement $current by $size until we reach $min
$current = $max;
while ($current >= $min) {
$start = max($min, $current + 1 - $size);
$end = max($min, $current);
$progress->setMessage($this->user->lang('CLI_REPARSER_REPARSE_REPARSING', preg_replace('(^text_reparser\\.)', '', $name), $start, $end));
$reparser->reparse_range($start, $end);
$current = $start - 1;
$progress->setProgress($max + 1 - $start);
$this->update_resume_data($name, $current);
}
$progress->finish();
$this->io->newLine(2);
}
示例9: execute
/**
* Executes the command reparser:list
*
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->section($this->user->lang('CLI_DESCRIPTION_REPARSER_AVAILABLE'));
$io->listing($this->reparser_names);
return 0;
}
示例10: updateChangelog
/**
* @return Changelog
*/
protected function updateChangelog()
{
// If the release already exists and we don't want to overwrite it, cancel
$question = 'Version <comment>' . $this->version . '</comment> already exists, create anyway?';
if ($this->changelog->hasRelease($this->version) && !$this->output->confirm($question, false)) {
return false;
}
// Summarize commits
$this->summarizeCommits();
// Gather changes for new version
$this->output->section('Gathering changes for <comment>' . $this->version . '</comment>');
$changes = $this->gatherChanges();
if (!$changes) {
$this->output->error('No changes to create version with');
return false;
}
if ($this->from) {
$from = $this->changelog->getRelease($this->from);
$this->changelog->removeRelease($this->from);
$changes = array_merge_recursive($from['changes'], $changes);
}
// Add to changelog
$this->changelog->addRelease(['name' => $this->version, 'date' => date('Y-m-d'), 'changes' => $changes]);
// Show to user and confirm
$preview = $this->changelog->toMarkdown();
$this->output->note($preview);
if (!$this->output->confirm('This is your new CHANGELOG.md, all good?')) {
return false;
}
// Write out to CHANGELOG.md
$this->changelog->save();
return $this->changelog;
}
示例11: listAttendants
/**
* @return int
*/
protected function listAttendants()
{
$attendants = array_map(function (CacheAttendantInterface $a) {
return ClassInfo::getClassNameByInstance($a);
}, $this->getCacheAttendants([], true));
$header = ['Cache Registrar Name', 'Enabled', 'Initialized'];
if ($this->output->isVerbose()) {
$header = array_merge($header, ['TTL', 'Key Prefix', 'Hash Algo', 'Item Count']);
}
$rows = [];
foreach ($attendants as $i => $name) {
$instance = $this->getCacheAttendants([$name])[0];
$rows[$i] = [$name, $instance->isEnabled() ? 'Yes' : '<fg=white>No</>', $instance->isInitialized() ? 'Yes' : '<fg=white>No</>'];
if (!$this->output->isVerbose()) {
continue;
}
$ttl = $this->getAttendantTtl($instance);
$gen = $this->getAttendantKeyGenerator($instance);
try {
$num = count($instance->listKeys());
} catch (\Exception $e) {
$num = '<fg=white>n/a</>';
}
$rows[$i] = array_merge($rows[$i], [$ttl === 0 ? '<fg=white>0</>' : $ttl, $gen->getPrefix(), $gen->getAlgorithm(), $num]);
}
$this->io->section('Cache Registry Attendant Listing');
$this->io->table($header, $rows);
return 0;
}
示例12: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->title('Payroll sending for ' . $input->getArgument('month'));
try {
$io->section('Checking server');
$io->success($this->checkServer());
$io->section('Processing Employee list');
$this->bus->execute(new DistributePayroll(new PayrollMonth($input->getArgument('month'), $input->getArgument('year')), $input->getArgument('paths')));
$io->success('Task ended.');
} catch (\Milhojas\Infrastructure\Persistence\Management\Exceptions\PayrollRepositoryDoesNotExist $e) {
$io->warning(array(sprintf($e->getMessage()), 'Please, review config/services/management.yml parameter: payroll.dataPath', 'Use a path to a valid folder containing payroll files or payroll zip archives.'));
} catch (\Milhojas\Infrastructure\Persistence\Management\Exceptions\PayrollRepositoryForMonthDoesNotExist $e) {
$io->warning(array($e->getMessage(), 'Please, add the needed folder or zip archives for month data.', 'Use a path to a valid folder containing payroll files.'));
} catch (\RuntimeException $e) {
$io->error(array($e->getMessage(), 'Check Internet connectivity and try again later.'));
}
}
示例13: execute
/**
* @inheritDoc
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$helper = new SymfonyStyle($input, $output);
$helper->title('Doctrine');
$choices = [self::ACTION_DATABASE_IMPORT => 'Import database from remote host'];
$todo = $helper->choice('Select action', $choices);
$helper->newLine(4);
$helper->section($choices[$todo]);
$this->executeChoice($helper, $todo);
CommandUtility::writeFinishedMessage($helper, self::NAME);
}
示例14: execute
/**
* @inheritDoc
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$helper = new SymfonyStyle($input, $output);
$helper->title('FOSUserBundle');
$choices = [self::ACTION_PASSWORD_REPLACE => 'Replace all passwords (be careful!)'];
$todo = $helper->choice('Select action', $choices);
$helper->newLine(4);
$helper->section($choices[$todo]);
$this->executeChoice($helper, $todo);
CommandUtility::writeFinishedMessage($helper, self::NAME);
}
示例15: execute
public function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->title('OpenCFP');
$io->section('Clearing caches');
$paths = [$this->app->cachePurifierPath(), $this->app->cacheTwigPath()];
array_walk($paths, function ($path) use($io) {
passthru(sprintf('rm -rf %s/*', $path));
$io->writeln(sprintf(' * %s', $path));
});
$io->success('Cleared caches.');
}