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


PHP Table::setStyle方法代码示例

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


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

示例1: 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

示例2: execute

 /**
  * Execute the command
  *
  * @param InputInterface  $input  the user input
  * @param OutputInterface $output the command line output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $webfinger = new Net_WebFinger();
     // is http fallback enabled
     if ($input->getOption('insecure')) {
         $webfinger->fallbackToHttp = true;
     }
     $react = $webfinger->finger($input->getArgument("resource"));
     $output->writeln("<info>Data source URL: {$react->url}</info>");
     $output->writeln("<comment>Information secure: " . var_export($react->secure, true) . "</comment>");
     // check for errors
     if ($react->error !== null) {
         $this->displayError($react->error, $output);
         //return;
     }
     $helper = new \Lib\WebFingerHelper($react);
     // show profile
     $output->writeln("\n<info>Profile:</info>");
     $profile = $helper->getProfileTableView();
     $table = new Table($output);
     $table->setRows($profile);
     $table->setStyle('compact');
     $table->render();
     // show alternate identifier
     $output->writeln("\n<info>Alternate Identifier:</info>");
     foreach ($react->aliases as $alias) {
         $output->writeln(" * {$alias}");
     }
     // show links
     $output->writeln("\n<info>More Links:</info>");
     $links = $helper->getLinksTableView();
     $table = new Table($output);
     $table->setHeaders(array('Type', 'Link'))->setRows($links);
     $table->render();
 }
开发者ID:pfefferle,项目名称:webfinger-cli,代码行数:41,代码来源:WebFingerCommand.php

示例3: doExecute

 /**
  * {@inheritdoc}
  */
 protected function doExecute(InputInterface $input, OutputInterface $output, $options)
 {
     $site_id = $input->getOption('site-id');
     $response = $this->client->get('snapshots/' . $site_id, $options);
     if ($response->getStatusCode() != 200) {
         $output->writeln("Error calling dashboard API");
     } else {
         $json = $response->getBody();
         $snapshot = json_decode($json, TRUE);
         $table = new Table($output);
         $table->addRow(['Timestamp:', $snapshot['timestamp']]);
         $table->addRow(['Client ID:', $snapshot['client_id']]);
         $table->addRow(['Site ID:', $snapshot['site_id']]);
         $table->setStyle('compact');
         $table->render();
         $checks = $snapshot['checks'];
         $table = new Table($output);
         $table->setHeaders(['Type', 'Name', 'Description', 'Alert Level']);
         foreach ($checks as $check) {
             $table->addRow([$check['type'], $check['name'], $this->truncate($check['description']), $this->formatAlert($check['alert_level'])]);
         }
         $table->setStyle('borderless');
         $table->render();
     }
 }
开发者ID:bwood,项目名称:dashboard-console,代码行数:28,代码来源:SnapshotCommand.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $drupal_version = $input->getArgument('tag');
     $table = new Table($output);
     $table->setStyle('compact');
     $this->getAllMigrations($drupal_version, $output, $table);
 }
开发者ID:legovaer,项目名称:DrupalConsole,代码行数:7,代码来源:DebugCommand.php

示例5: renderReport

 /**
  * This method will be called when the engine has finished the source analysis
  * phase.
  *
  * @param \PHPMD\Report $report
  */
 public function renderReport(Report $report)
 {
     $this->output->writeln('');
     $groupByFile = [];
     /** @var RuleViolation $violation */
     foreach ($report->getRuleViolations() as $violation) {
         $groupByFile[$violation->getFileName()][] = $violation;
     }
     /** @var ProcessingError $error */
     foreach ($report->getErrors() as $error) {
         $groupByFile[$error->getFile()][] = $error;
     }
     foreach ($groupByFile as $file => $problems) {
         $violationCount = 0;
         $errorCount = 0;
         $table = new Table($this->output);
         $table->setStyle('borderless');
         foreach ($problems as $problem) {
             if ($problem instanceof RuleViolation) {
                 $table->addRow([$problem->getBeginLine(), '<comment>VIOLATION</comment>', $problem->getDescription()]);
                 ++$violationCount;
             }
             if ($problem instanceof ProcessingError) {
                 $table->addRow(['-', '<error>ERROR</error>', $problem->getMessage()]);
                 ++$errorCount;
             }
         }
         $this->output->writeln([sprintf('<fg=white;options=bold>FILE: %s</>', str_replace($this->basePath . '/', '', $file)), sprintf('<fg=white;options=bold>FOUND %d ERRORS AND %d VIOLATIONS</>', $errorCount, $violationCount)]);
         $table->render();
         $this->output->writeln('');
     }
 }
开发者ID:gjb2048,项目名称:moodle-plugin-ci,代码行数:38,代码来源:MessDetectorRenderer.php

示例6: doExecute

 /**
  * {@inheritdoc}
  */
 protected function doExecute(InputInterface $input, OutputInterface $output, $options)
 {
     $client_id = $input->getOption('client-id');
     if (isset($client_id)) {
         $options['query']['client_id'] = $client_id;
     }
     $name = $input->getOption('check-name');
     if (isset($name)) {
         $options['query']['name'] = $name;
     }
     $type = $input->getOption('check-type');
     if (isset($type)) {
         $options['query']['type'] = $type;
     }
     $response = $this->client->get('snapshots', $options);
     if ($response->getStatusCode() != 200) {
         $output->writeln("Error calling dashboard API");
     } else {
         $json = $response->getBody();
         $sites = json_decode($json, TRUE);
         $table = new Table($output);
         $table->setHeaders(['Timestamp', 'Client ID', 'Site ID', 'Notice', 'Warning', 'Error']);
         foreach ($sites as $site) {
             $table->addRow([$site['timestamp'], $site['client_id'], $site['site_id'], $this->formatAlert('notice', $site['alert_summary']['notice']), $this->formatAlert('warning', $site['alert_summary']['warning']), $this->formatAlert('error', $site['alert_summary']['error'])]);
         }
         $table->setStyle('borderless');
         $table->render();
     }
 }
开发者ID:bwood,项目名称:dashboard-console,代码行数:32,代码来源:SnapshotsCommand.php

示例7: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var Jarves $jarves */
     $jarves = $this->getContainer()->get('jarves');
     $table = new Table($output);
     $table->setStyle('compact');
     $table->setHeaders(['Domain', 'Type', 'Title', 'Method', 'Path', 'Controller']);
     $frontendRouter = $this->getContainer()->get('jarves.frontend_router');
     $frontendRouter->setRequest(new Request());
     $nodes = NodeQuery::create()->filterByLft(1, Criteria::GREATER_THAN)->orderByDomainId()->orderByLft()->find();
     $typeNames = [null => '', 0 => 'Page', 1 => 'Link', 2 => 'Navigation', 3 => 'Deposit'];
     foreach ($nodes as $node) {
         $routes = new RouteCollection();
         $frontendRouter->setRoutes($routes);
         $frontendRouter->registerMainPage($node);
         $frontendRouter->registerPluginRoutes($node);
         /** @var $route \Symfony\Component\Routing\Route */
         foreach ($routes as $route) {
             $titleSuffix = '';
             if ($route->hasDefault('_title')) {
                 $titleSuffix .= ' (' . $route->getDefault('_title') . ')';
             }
             $table->addRow([$node->getDomain()->getDomain(), $typeNames[$node->getType()], str_repeat('  ', $node->getLvl()) . $node->getTitle() . $titleSuffix, join(',', $route->getMethods()), $node->getType() === 3 ? '' : $route->getPath(), $route->getDefault('_controller')]);
         }
     }
     $table->render();
 }
开发者ID:jarves,项目名称:jarves,代码行数:30,代码来源:FrontendCommand.php

示例8: generate

 /**
  * Generates the output for the report.
  *
  * @param ConsoleLoggerInterface $logger
  */
 public function generate(ConsoleLoggerInterface $logger)
 {
     $logLevel = LogLevel::NOTICE;
     $style = TitleBlock::STYLE_SUCCESS;
     if ($this->eventDataCollector->hasCountedFailedEvents()) {
         $logLevel = LogLevel::ERROR;
         $style = TitleBlock::STYLE_FAILURE;
     } elseif ($this->eventDataCollector->hasCountedLogLevel(LogLevel::EMERGENCY) || $this->eventDataCollector->hasCountedLogLevel(LogLevel::ALERT) || $this->eventDataCollector->hasCountedLogLevel(LogLevel::CRITICAL) || $this->eventDataCollector->hasCountedLogLevel(LogLevel::ERROR) || $this->eventDataCollector->hasCountedLogLevel(LogLevel::WARNING)) {
         $logLevel = LogLevel::WARNING;
         $style = TitleBlock::STYLE_ERRORED_SUCCESS;
     }
     $output = $logger->getOutput($logLevel);
     $titleBlock = new TitleBlock($output, $this->messages[$style], $style);
     $titleBlock->render();
     $dataCollectorsData = array();
     foreach ($this->dataCollectors as $dataCollector) {
         $data = $dataCollector->getData($logger->getVerbosity());
         foreach ($data as $label => $value) {
             $dataCollectorsData[] = array($label, $value);
         }
     }
     $table = new Table($output);
     $table->setRows($dataCollectorsData);
     $table->setStyle('symfony-style-guide');
     $table->render();
     $output->writeln('');
 }
开发者ID:deborahvandervegt,项目名称:accompli,代码行数:32,代码来源:AbstractReport.php

示例9: write

 /**
  *
  * {@inheritDoc}
  *
  * @see \SK\ITCBundle\Service\Table\Adapter\IAdapter::write()
  */
 public function write(Table $table, OutputInterface $output)
 {
     $style = new TableStyle();
     $style->setHorizontalBorderChar('<fg=magenta>-</>')->setVerticalBorderChar('<fg=magenta>|</>')->setCrossingChar('<fg=magenta>+</>');
     $stable = new STable($output);
     $stable->setStyle('default');
     $stable->setHeaders($table->getHeaders());
     $columns = $table->getColumns();
     $colspan = count($columns);
     $rows = $table->getRows();
     foreach ($rows as $row) {
         $rowModificated = [];
         foreach ($columns as $iCol => $col) {
             if (is_int($iCol)) {
                 $iCol = $col;
             }
             if (array_key_exists($iCol, $row)) {
                 $rowModificated[$iCol] = wordwrap($row[$iCol], $table->getMaxColWidth(), "\n", true);
             } else {
                 $rowModificated[$iCol] = "";
             }
         }
         $stable->addRow($rowModificated);
         $stable->addRow(array(new TableSeparator(array('colspan' => $colspan))));
     }
     $stable->addRow(array(new TableCell("", array('colspan' => $colspan))));
     $stable->addRow(array(new TableCell(sprintf("Found %s results.", count($rows)), array('colspan' => $colspan))));
     $stable->render();
 }
开发者ID:slavomirkuzma,项目名称:itc-bundle,代码行数:35,代码来源:TXT.php

示例10: getAllEvents

 protected function getAllEvents($event_type, $event_severity, $user_id, $offset, $limit, $output)
 {
     $table = new Table($output);
     $table->setStyle('compact');
     $connection = $this->getDatabase();
     $date_formatter = $this->getDateFormatter();
     $user_storage = $this->getEntityManager()->getStorage('user');
     $severity = RfcLogLevel::getLevels();
     $query = $connection->select('watchdog', 'w');
     $query->fields('w', array('wid', 'uid', 'severity', 'type', 'timestamp', 'message', 'variables'));
     if (!empty($event_type)) {
         $query->condition('type', $event_type);
     }
     if (!empty($event_severity) && in_array($event_severity, $severity)) {
         $query->condition('severity', array_search($event_severity, $severity));
     } elseif (!empty($event_severity)) {
         $output->writeln('[-] <error>' . sprintf($this->trans('commands.database.log.debug.messages.invalid-severity'), $event_severity) . '</error>');
     }
     if (!empty($user_id)) {
         $query->condition('uid', $user_id);
     }
     if (!$offset) {
         $offset = 0;
     }
     if ($limit) {
         $query->range($offset, $limit);
     }
     $result = $query->execute();
     $table->setHeaders([$this->trans('commands.database.log.debug.messages.event-id'), $this->trans('commands.database.log.debug.messages.type'), $this->trans('commands.database.log.debug.messages.date'), $this->trans('commands.database.log.debug.messages.message'), $this->trans('commands.database.log.debug.messages.user'), $this->trans('commands.database.log.debug.messages.severity')]);
     foreach ($result as $dblog) {
         $user = $user_storage->load($dblog->uid);
         $table->addRow([$dblog->wid, $dblog->type, $date_formatter->format($dblog->timestamp, 'short'), Unicode::truncate(Html::decodeEntities(strip_tags($this->formatMessage($dblog))), 56, true, true), $user->getUsername() . ' (' . $user->id() . ')', $severity[$dblog->severity]]);
     }
     $table->render();
 }
开发者ID:legovaer,项目名称:DrupalConsole,代码行数:35,代码来源:LogDebugCommand.php

示例11: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $language = $input->getArgument('language');
     $table = new Table($output);
     $table->setStyle('compact');
     $this->displayUpdates($language, $output, $table);
 }
开发者ID:legovaer,项目名称:DrupalConsole,代码行数:7,代码来源:TranslationStatusCommand.php

示例12: 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

示例13: 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

示例14: fire

 /**
  * Execute the console command.
  *
  * @return null|int
  */
 protected function fire()
 {
     $table = new Table($this->output);
     $table->setHeaders(['Name', 'Path', 'Description'])->setRows($this->collectRows());
     $table->setStyle('borderless');
     $table->render();
 }
开发者ID:arrilot,项目名称:bitrix-migrations,代码行数:12,代码来源:TemplatesCommand.php

示例15: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $path = $input->getArgument('config_file') ? $input->getArgument('config_file') : $this->configDefaultPath;
     $output->writeln('Linting <info>' . basename($path) . '</info>...');
     if (!is_file($path)) {
         throw new \InvalidArgumentException('"' . $path . '" is not a file.');
     } elseif (!is_readable($path)) {
         throw new \InvalidArgumentException('"' . $path . '" can not be read.');
     }
     $verifyLogFiles = $input->getOption('check-files');
     if ($verifyLogFiles) {
         $output->writeln('<comment>Also checking if the log files can be accessed.</comment>');
     }
     $output->writeln('');
     $lint = Config::lint(file_get_contents($path), $verifyLogFiles);
     $checkLines = [];
     foreach ($lint['checks'] as $check) {
         $checkLines = $this->prepareCheckLine($checkLines, $check);
     }
     $output->writeln('Checks:');
     $table = new Table($output);
     $table->setStyle('compact');
     $table->setRows($checkLines);
     $table->render();
     $output->writeln('');
     if ($lint['valid']) {
         $output->writeln('<fg=green>Your config file is valid.</>');
     } else {
         $output->writeln('<error> Your config file is not valid. </error>');
     }
 }
开发者ID:syonix,项目名称:log-viewer-lib,代码行数:31,代码来源:LintCommand.php


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