本文整理汇总了PHP中Symfony\Component\Console\Style\SymfonyStyle::table方法的典型用法代码示例。如果您正苦于以下问题:PHP SymfonyStyle::table方法的具体用法?PHP SymfonyStyle::table怎么用?PHP SymfonyStyle::table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Style\SymfonyStyle
的用法示例。
在下文中一共展示了SymfonyStyle::table方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
示例2: 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;
}
示例3: 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);
}
示例4: 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);
}
示例5: 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.');
}
示例6: 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);
}
}
示例7: 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;
}
示例8: printDefinitions
/**
* Print the current definitions.
*/
protected function printDefinitions()
{
$this->title('Definitions');
$rows = [];
foreach ($this->configuration->getDefinitionProviders() as $definition) {
if ($definition instanceof ImmutableContainerAwareInterface) {
$definition->setContainer(new Container());
}
$parameters = [];
$reflection = new ReflectionClass($definition);
if ($reflection->getProperties()) {
foreach ($reflection->getProperties() as $parameter) {
if ($parameter->getName() === 'container') {
continue;
}
// Extract parameter type
$doc = $parameter->getDocComment();
preg_match('/.*@(type|var) (.+)\\n.*/', $doc, $type);
$type = $type[2];
$parameters[] = '<info>' . $parameter->getName() . '</info>: ' . $type;
}
}
$definitions = array_keys($definition->getDefinitions());
foreach ($definitions as $key => $binding) {
$definitions[$key] = is_string($binding) ? $key + 1 . '. <comment>' . $binding . '</comment>' : null;
}
$rows[] = ['definition' => '<comment>' . get_class($definition) . '</comment>', 'options' => implode(PHP_EOL, $parameters), 'bindings' => implode(PHP_EOL, $definitions)];
$rows[] = new TableSeparator();
}
$this->output->table(['Definition', 'Options', 'Bindings'], array_slice($rows, 0, -1));
}
示例9: 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();
}
}
}
示例10: execute
public function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$pastDate = $input->getOption(self::PAST_DATE) ? new DateTime($input->getOption(self::PAST_DATE)) : null;
$data = $this->vendorProcessor->getWallets($this->merchantGroupId, $pastDate);
$io->title("Hipay Wallets");
$io->table(array_keys(reset($data)), $data);
}
示例11: displayAsTable
protected function displayAsTable(SymfonyStyle $io, $header, $results)
{
$rows = [];
foreach ($results as $day => $shows_per_day) {
foreach ($shows_per_day as $result) {
$rows[] = $this->getRow(...$result);
}
}
$io->table($header, $rows);
}
示例12: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$output = new SymfonyStyle($input, $output);
$queues = $this->queueRegistry->all();
$tableInput = array();
foreach ($queues as $queue) {
$tableInput[] = array($queue->getName(), $queue->count());
}
$output->table(array('Name', 'Outstanding jobs'), $tableInput);
}
示例13: listTransactions
protected function listTransactions($transactions)
{
$rows = array();
$timecolumn = 2;
array_walk($transactions, function ($transaction) use(&$rows) {
$row = [$transaction["txid"], $transaction["confirmations"], $transaction["time"]];
$rows[] = $row;
});
usort($rows, function ($a, $b) use($timecolumn) {
if ($a[$timecolumn] == $b[$timecolumn]) {
return 0;
}
return $a[$timecolumn] < $b[$timecolumn] ? 1 : -1;
});
array_walk($rows, function (&$row) use($timecolumn) {
$row[$timecolumn] = $this->time2str($row[$timecolumn]);
});
$this->io->table(["Txid", "Confirmations", "Time"], $rows);
}
示例14: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$output = new SymfonyStyle($input, $output);
$workers = $this->workerRegistry->all();
$tableInput = array();
foreach ($workers as $worker) {
$tableInput[] = array($worker->getId(), $worker->getHostname(), $worker->getProcess()->getPid(), $worker->getCurrentJob());
}
$output->table(array('Id', 'Hostname', 'Pid', 'Current job'), $tableInput);
}
示例15: confirmConfiguration
protected function confirmConfiguration()
{
$rows = [];
foreach ($this->config as $section => $values) {
foreach ($values as $name => $value) {
$rows[] = [$name, $value];
}
}
$this->io->table(['Name', 'Value'], $rows);
return $this->io->askQuestion(new ConfirmationQuestion('Are these settings correct?'));
}