当前位置: 首页>>代码示例>>PHP>>正文


PHP Table::render方法代码示例

本文整理汇总了PHP中Symfony\Component\Console\Helper\Table::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::render方法的具体用法?PHP Table::render怎么用?PHP Table::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Console\Helper\Table的用法示例。


在下文中一共展示了Table::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test

 protected function test($count, $classes, OutputInterface $output)
 {
     $this->table = new Table($output);
     $this->table->setHeaders(array('Implementation', 'Memory', 'Duration'));
     $output->writeln(sprintf('<info>%d elements</info>', $count));
     $this->process = new ProgressBar($output, count($classes));
     $this->process->start();
     foreach ($classes as $class) {
         $shortClass = $class;
         //            if (in_array($class, $blacklist)) {
         //                $this->table->addRow([$class, '--', '--']);
         //                continue;
         //            };
         $path = __DIR__ . '/../../bin/test.php';
         $result = `php {$path} {$class} {$count}`;
         $data = json_decode($result, true);
         if (!$data) {
             echo $result;
         }
         $this->table->addRow([$shortClass, sprintf('%11sb', number_format($data['memory'])), sprintf('%6.4fs', $data['time'])]);
         $this->process->advance();
     }
     $this->process->finish();
     $output->writeln('');
     $this->table->render($output);
 }
开发者ID:Pandahisham,项目名称:topsort.php,代码行数:26,代码来源:BenchmarkCommand.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $table = new Table($output);
     $table->setStyle('compact');
     $environment = $input->getArgument('environment');
     if (in_array($environment, array('dev', 'prod'))) {
         $loadedConfigurations = $this->loadConfigurations($environment);
     } else {
         $output->writeln(' <error>' . $this->trans('commands.site.mode.messages.invalid-env') . '</error>');
     }
     $configurationOverrideResult = $this->overrideConfigurations($loadedConfigurations['configurations']);
     foreach ($configurationOverrideResult as $configName => $result) {
         $output->writeln(sprintf(' <info>%s:</info> <comment>%s</comment>', $this->trans('commands.site.mode.messages.configuration'), $configName));
         $table->setHeaders([$this->trans('commands.site.mode.messages.configuration-key'), $this->trans('commands.site.mode.messages.original'), $this->trans('commands.site.mode.messages.updated')]);
         $table->setRows($result);
         $table->render();
         $output->writeln('');
     }
     $servicesOverrideResult = $this->overrideServices($loadedConfigurations['services'], $output);
     if (!empty($servicesOverrideResult)) {
         $output->writeln(' <info>' . $this->trans('commands.site.mode.messages.new-services-settings') . '</info>');
         $table->setHeaders([$this->trans('commands.site.mode.messages.service'), $this->trans('commands.site.mode.messages.service-parameter'), $this->trans('commands.site.mode.messages.service-value')]);
         $table->setStyle('compact');
         $table->setRows($servicesOverrideResult);
         $table->render();
     }
     $this->getChain()->addCommand('cache:rebuild', ['cache' => 'all']);
 }
开发者ID:legovaer,项目名称:DrupalConsole,代码行数:28,代码来源:ModeCommand.php

示例3: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->table->setHeaders(['id', 'Title', 'Description']);
     foreach ($this->repository->getAll() as $exercise) {
         $this->table->addRow([$exercise->getId(), $exercise->getTitle(), $exercise->getDescription()]);
     }
     $this->table->render();
 }
开发者ID:jehaby,项目名称:exesise,代码行数:8,代码来源:ListExercises.php

示例4: printRecievers

 /**
  * @param Reciever[] $recievers
  */
 public function printRecievers(array $recievers)
 {
     $this->table->setHeaders(['name', 'email']);
     $rows = [];
     foreach ($recievers as $reciever) {
         $rows[] = [$reciever->getFullName(), $reciever->getEmail()];
     }
     $this->table->setRows($rows);
     $this->table->render();
     $this->table->setRows([]);
 }
开发者ID:cinno,项目名称:massmailer-1,代码行数:14,代码来源:RecieverPrinter.php

示例5: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $namespaces = $this->getContainer()->get('solr.doctrine.classnameresolver.known_entity_namespaces');
     $metaInformationFactory = $this->getContainer()->get('solr.meta.information.factory');
     foreach ($namespaces->getEntityClassnames() as $classname) {
         try {
             $metaInformation = $metaInformationFactory->loadInformation($classname);
         } catch (\RuntimeException $e) {
             $output->writeln(sprintf('<info>%s</info>', $e->getMessage()));
             continue;
         }
         $output->writeln(sprintf('<comment>%s</comment>', $classname));
         $output->writeln(sprintf('Documentname: %s', $metaInformation->getDocumentName()));
         $output->writeln(sprintf('Document Boost: %s', $metaInformation->getBoost() ? $metaInformation->getBoost() : '-'));
         $table = new Table($output);
         $table->setHeaders(array('Property', 'Document Fieldname', 'Boost'));
         foreach ($metaInformation->getFieldMapping() as $documentField => $property) {
             $field = $metaInformation->getField($documentField);
             if ($field === null) {
                 continue;
             }
             $table->addRow(array($property, $documentField, $field->boost));
         }
         $table->render();
     }
 }
开发者ID:zquintana,项目名称:SolrBundle,代码行数:29,代码来源:ShowSchemaCommand.php

示例6: dumpProcessors

 /**
  * @param OutputInterface $output
  * @param string          $action
  */
 protected function dumpProcessors(OutputInterface $output, $action)
 {
     /** @var ProcessorBagInterface $processorBag */
     $processorBag = $this->getContainer()->get('oro_api.processor_bag');
     $table = new Table($output);
     $table->setHeaders(['Processor', 'Attributes']);
     $context = new Context();
     $context->setAction($action);
     $processors = $processorBag->getProcessors($context);
     $processors->setApplicableChecker(new ChainApplicableChecker());
     $i = 0;
     foreach ($processors as $processor) {
         if ($i > 0) {
             $table->addRow(new TableSeparator());
         }
         $processorColumn = sprintf('<comment>%s</comment>%s%s', $processors->getProcessorId(), PHP_EOL, get_class($processor));
         $processorDescription = $this->getClassDocComment(get_class($processor));
         if (!empty($processorDescription)) {
             $processorColumn .= PHP_EOL . $processorDescription;
         }
         $attributesColumn = $this->formatProcessorAttributes($processors->getProcessorAttributes());
         $table->addRow([$processorColumn, $attributesColumn]);
         $i++;
     }
     $table->render();
 }
开发者ID:Maksold,项目名称:platform,代码行数:30,代码来源:DebugCommand.php

示例7: execute

 /**
  * @{inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->classContentManager = $this->getApplication()->getApplication()->getContainer()->get('classcontent.manager');
     $this->classContents = $this->classContentManager->getAllClassContentClassnames();
     /*
      * @todo: better to use isEnabled to hide this function if no class contents were found ?
      */
     if (!is_array($this->classContents) || count($this->classContents) <= 0) {
         throw new \LogicException('You don`t have any Class content in application');
     }
     if ($input->getArgument('classname')) {
         $output->writeln($this->describeClassContent($input->getArgument('classname')));
         return;
     }
     $output->writeln($this->getHelper('formatter')->formatSection('Class Contents', 'List of available Class Contents'));
     $output->writeln('');
     $headers = array('Name', 'Classname');
     $table = new Table($output);
     $table->setHeaders($headers)->setStyle('compact');
     foreach ($this->classContents as $classContent) {
         $instance = new $classContent();
         $table->addRow([$instance->getProperty('name'), $classContent]);
     }
     $table->render();
 }
开发者ID:backbee,项目名称:debug-bundle,代码行数:28,代码来源:DebugClassContentCommand.php

示例8: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $isVerbose = $output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
     $projectCode = $input->getOption('project-code');
     $enrollmentStatusCode = $input->getOption('enrollment-status-code');
     $memberResource = new MemberResource($this->sourceClient);
     $page = 0;
     $perPage = 10;
     $maxPages = 1;
     $criteria = [];
     if ($enrollmentStatusCode) {
         $criteria['enrollment_status_code'] = $enrollmentStatusCode;
     }
     $data = [];
     while ($page < $maxPages) {
         $members = $memberResource->getList(++$page, $perPage, $criteria, [], [], ['project_code' => $projectCode]);
         $maxPages = $members['pages'];
         // if no items, return
         if (!count($members['items']) || !$members['total']) {
             break;
         }
         foreach ($members['items'] as $key => $member) {
             if ($isVerbose) {
                 $no = ($page - 1) * $perPage + $key + 1;
                 //                    $output->writeln("{$no} - Reading member #{$member['id']}");
             }
             $data[] = ['code' => isset($member['code']) ? $member['code'] : '#' . $member['id'], 'email' => isset($member['email_within_project']) ? $member['email_within_project'] : '-', 'phone' => isset($member['phone_within_project']) ? $member['phone_within_project'] : '-', 'enrollment_status_code' => isset($member['enrollment_status_code']) ? $member['enrollment_status_code'] : '-'];
         }
     }
     $table = new Table($output);
     $table->setHeaders(['code', 'email', 'phone', 'enrollment_status_code'])->setRows($data);
     $table->render();
 }
开发者ID:survos,项目名称:platform-recipes,代码行数:33,代码来源:MemberSummaryCommand.php

示例9: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $missingOption = [];
     $optionScopeCount = 1;
     if (null === ($rainbowTablePath = $input->getOption("rainbow-table"))) {
         $missingOption[] = "rainbow-table";
     }
     if ($optionScopeCount === count($missingOption)) {
         throw MissingOptionException::create($missingOption);
     }
     $rainbowTable = new FileHandler($rainbowTablePath, FileHandlerInterface::MODE_READ_ONLY);
     $mode = RainbowPHPInterface::LOOKUP_MODE_SIMPLE;
     if ($input->getOption("partial")) {
         $mode |= RainbowPHPInterface::LOOKUP_MODE_PARTIAL;
     }
     if ($input->getOption("deep-search")) {
         $mode |= RainbowPHPInterface::LOOKUP_MODE_DEEP;
     }
     $hash = $input->getArgument("hash");
     $foundHashes = $this->rainbow->lookupHash($rainbowTable, $hash, $mode);
     if (empty($foundHashes)) {
         $output->writeln(sprintf("No value found for the hash '%s'", $hash));
     } else {
         $tableHelper = new Table($output);
         $tableHelper->setHeaders(["Hash", "Value"]);
         foreach ($foundHashes as $value => $foundHash) {
             $tableHelper->addRow([$foundHash, $value]);
         }
         $tableHelper->render();
     }
 }
开发者ID:lovenunu,项目名称:rainbowphp,代码行数:31,代码来源:RainbowLookupHashCommand.php

示例10: render

 /**
  * Renders table to output.
  *
  * Example:
  * +---------------+-----------------------+------------------+
  * | ISBN          | Title                 | Author           |
  * +---------------+-----------------------+------------------+
  * | 99921-58-10-7 | Divine Comedy         | Dante Alighieri  |
  * | 9971-5-0210-0 | A Tale of Two Cities  | Charles Dickens  |
  * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
  * +---------------+-----------------------+------------------+
  *
  * @param OutputInterface $output
  */
 public function render(OutputInterface $output)
 {
     $p = new \ReflectionProperty($this->table, 'output');
     $p->setAccessible(true);
     $p->setValue($this->table, $output);
     $this->table->render();
 }
开发者ID:kchhainarong,项目名称:chantuchP,代码行数:21,代码来源:TableHelper.php

示例11: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $groupPattern = $input->getArgument('group');
     if (empty($groupPattern)) {
         $groupPattern = '.*';
     }
     $cloudwatchLogsClient = \AwsInspector\SdkFactory::getClient('cloudwatchlogs');
     /* @var $cloudwatchLogsClient \Aws\CloudWatchLogs\CloudWatchLogsClient */
     $table = new Table($output);
     $table->setHeaders(['Name', 'Retention [days]', 'Size [MB]']);
     $totalBytes = 0;
     $nextToken = null;
     do {
         $params = ['limit' => 50];
         if ($nextToken) {
             $params['nextToken'] = $nextToken;
         }
         $result = $cloudwatchLogsClient->describeLogGroups($params);
         foreach ($result->get('logGroups') as $logGroup) {
             $name = $logGroup['logGroupName'];
             if (preg_match('/' . $groupPattern . '/', $name)) {
                 $table->addRow([$logGroup['logGroupName'], isset($logGroup['retentionInDays']) ? $logGroup['retentionInDays'] : 'Never', round($logGroup['storedBytes'] / (1024 * 1024))]);
                 $totalBytes += $logGroup['storedBytes'];
             }
         }
         $nextToken = $result->get("nextToken");
     } while ($nextToken);
     $table->render();
     $output->writeln('Total size: ' . $this->formatBytes($totalBytes));
 }
开发者ID:AOEpeople,项目名称:AwsInspector,代码行数:30,代码来源:ShowLogGroupsCommand.php

示例12: printRule

 /**
  * @param OutputInterface $output
  * @param RuleInterface $rule
  */
 private function printRule(OutputInterface $output, RuleInterface $rule)
 {
     $table = new Table($output);
     $table->setStyle('compact')->setRows([['Name', $rule->getName()], ['Category', $rule->getCategory()], ['Severity', $rule->getSeverity()], ['Message', $rule->getMessage()]]);
     $table->render();
     $output->writeln('---------------------------------------------');
 }
开发者ID:anroots,项目名称:pgca,代码行数:11,代码来源:ShowCommand.php

示例13: execute

 protected function execute(InputInterface $input, OutputInterface $output) : int
 {
     if (!$output->isQuiet()) {
         $output->writeln($this->getApplication()->getLongVersion());
     }
     $composerJson = $input->getArgument('composer-json');
     $this->checkJsonFile($composerJson);
     $getPackageSourceFiles = new LocateComposerPackageSourceFiles();
     $sourcesASTs = new LocateASTFromFiles((new ParserFactory())->create(ParserFactory::PREFER_PHP7));
     $definedVendorSymbols = (new LocateDefinedSymbolsFromASTRoots())->__invoke($sourcesASTs((new ComposeGenerators())->__invoke($getPackageSourceFiles($composerJson), (new LocateComposerPackageDirectDependenciesSourceFiles())->__invoke($composerJson))));
     $options = $this->getCheckOptions($input);
     $definedExtensionSymbols = (new LocateDefinedSymbolsFromExtensions())->__invoke((new DefinedExtensionsResolver())->__invoke($composerJson, $options->getPhpCoreExtensions()));
     $usedSymbols = (new LocateUsedSymbolsFromASTRoots())->__invoke($sourcesASTs($getPackageSourceFiles($composerJson)));
     $unknownSymbols = array_diff($usedSymbols, $definedVendorSymbols, $definedExtensionSymbols, $options->getSymbolWhitelist());
     if (!$unknownSymbols) {
         $output->writeln("There were no unknown symbols found.");
         return 0;
     }
     $output->writeln("The following unknown symbols were found:");
     $table = new Table($output);
     $table->setHeaders(['unknown symbol', 'guessed dependency']);
     $guesser = new DependencyGuesser();
     foreach ($unknownSymbols as $unknownSymbol) {
         $guessedDependencies = [];
         foreach ($guesser($unknownSymbol) as $guessedDependency) {
             $guessedDependencies[] = $guessedDependency;
         }
         $table->addRow([$unknownSymbol, implode("\n", $guessedDependencies)]);
     }
     $table->render();
     return (int) (bool) $unknownSymbols;
 }
开发者ID:pamil,项目名称:ComposerRequireChecker,代码行数:32,代码来源:CheckCommand.php

示例14: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $client = $this->get('client');
     $features = array();
     if (!empty($input->getOption('features'))) {
         $features = explode(',', $input->getOption('features'));
     }
     try {
         $result = $client->api('clients')->getList($features);
         $clients = array();
         if ('ok' === strtolower($result['stat']) && !empty($result['results'])) {
             $clients = $result['results'];
         }
         $rows = array();
         foreach ($clients as $client) {
             $rows[] = array($client['client_id'], $client['client_secret'], $client['description']);
         }
         $table = new Table($output);
         $table->setHeaders(array('client_id', 'client_secret', 'description'))->setRows($rows);
         $table->render();
         exit(0);
     } catch (\Exception $e) {
         $output->writeln('<error>' . $e->getMessage() . '</error>');
         exit(1);
     }
 }
开发者ID:xwp,项目名称:janrain-cli-tools,代码行数:26,代码来源:ClientListCommand.php

示例15: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $jobId = $input->getArgument('job-id');
     $stats = $this->getBeanstalk()->statsJob($jobId);
     $output->writeln("<info>[Job ID: {$jobId}]</info>");
     $table = new Table($output);
     $table->setStyle('compact');
     $details = array_intersect_key($stats, array_flip(['tube', 'state']));
     foreach ($details as $detail => $value) {
         if ($detail == 'state' && $value == 'buried') {
             $value = "<error>{$value}</error>";
         }
         $table->addRow([$detail, $value]);
     }
     $table->render();
     $created = time();
     $table = new Table($output);
     $stats = array_diff_key($stats, array_flip(['id', 'tube', 'state']));
     $table->setHeaders(['Stat', 'Value']);
     foreach ($stats as $stat => $value) {
         if ($stat == 'age') {
             $created = time() - (int) $value;
             $dt = date('Y-m-d H:i:s', $created);
             $table->addRow(['created', $dt]);
         } elseif ($stat == 'delay') {
             $dt = date('Y-m-d H:i:s', $created + (int) $value);
             $table->addRow(['scheduled', $dt]);
         }
         $table->addRow([$stat, $value]);
     }
     $table->render();
 }
开发者ID:phlib,项目名称:beanstalk,代码行数:32,代码来源:JobStatsCommand.php


注:本文中的Symfony\Component\Console\Helper\Table::render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。