當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SymfonyStyle::table方法代碼示例

本文整理匯總了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();
     }
 }
開發者ID:symplify,項目名稱:php7_codesniffer,代碼行數:9,代碼來源:CodeSnifferStyle.php

示例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;
 }
開發者ID:qzminski,項目名稱:contao-core-bundle,代碼行數:14,代碼來源:SymlinksCommand.php

示例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);
 }
開發者ID:symfony,項目名稱:swiftmailer-bundle,代碼行數:33,代碼來源:DebugCommand.php

示例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);
 }
開發者ID:edetaillac,項目名稱:static-review,代碼行數:36,代碼來源:CheckRequirementsCommand.php

示例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.');
 }
開發者ID:kodazzi,項目名稱:framework,代碼行數:29,代碼來源:RoutesCommand.php

示例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);
     }
 }
開發者ID:campaignchain,項目名稱:update,代碼行數:35,代碼來源:UpdateSchemaCommand.php

示例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;
 }
開發者ID:scr-be,項目名稱:teavee-object-cache-bundle,代碼行數:32,代碼來源:CacheClearCommand.php

示例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));
 }
開發者ID:madewithlove,項目名稱:glue,代碼行數:34,代碼來源:ConfigurationCommand.php

示例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();
         }
     }
 }
開發者ID:octava,項目名稱:cms,代碼行數:33,代碼來源:GrantAllForGroupCommand.php

示例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);
 }
開發者ID:hipay,項目名稱:hipay-wallet-cashout-mirakl-integration,代碼行數:8,代碼來源:ListCommand.php

示例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);
 }
開發者ID:benjy,項目名稱:tv,代碼行數:10,代碼來源:CommandBase.php

示例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);
 }
開發者ID:php-resque,項目名稱:resque-bundle,代碼行數:10,代碼來源:QueueListCommand.php

示例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);
 }
開發者ID:Kunstmaan,項目名稱:hands-on-with-multichain,代碼行數:19,代碼來源:InputOutput.php

示例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);
 }
開發者ID:php-resque,項目名稱:resque-bundle,代碼行數:10,代碼來源:WorkerListCommand.php

示例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?'));
 }
開發者ID:axyr,項目名稱:silverstripe-cli-installer,代碼行數:11,代碼來源:NewCommand.php


注:本文中的Symfony\Component\Console\Style\SymfonyStyle::table方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。