Example #1
0
 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']);
 }
 /**
  * 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();
 }
 /**
  * {@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();
     }
 }
Example #4
0
 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);
 }
 /**
  * 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('');
     }
 }
 /**
  * {@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();
     }
 }
Example #7
0
 /**
  * {@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();
 }
 /**
  * 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('');
 }
Example #9
0
 /**
  *
  * {@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();
 }
 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();
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $language = $input->getArgument('language');
     $table = new Table($output);
     $table->setStyle('compact');
     $this->displayUpdates($language, $output, $table);
 }
Example #12
0
 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();
 }
Example #13
0
 /**
  * @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('---------------------------------------------');
 }
 /**
  * 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();
 }
Example #15
0
 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>');
     }
 }
Example #16
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     //         $name = $input->getArgument('name');
     //         if ($name) {
     //             $text = 'Hello '.$name;
     //         } else {
     //             $text = 'Hello';
     //         }
     //         if ($input->getOption('yell')) {
     //             $text = strtoupper($text);
     //         }
     //         $output->writeln($text);
     $helper = $this->getHelper('question');
     $question = new Question('<error>Please enter <info>the name of the bundle</error></info>');
     $bundle = $helper->ask($input, $output, $question);
     //         $question = new ChoiceQuestion(
     //             'Please select your favorite color (defaults to red)',
     //             array('asssssssssss' => 'red', 'blue', 'yellow'),
     //             0
     //         );
     //         $question->setErrorMessage('Color %s is invalid.');
     //         $color = $helper->ask($input, $output, $question);
     //         $output->writeln('You have just selected: '.$color);
     //         $question = new ChoiceQuestion(
     //             'Please select your favorite colors (defaults to red and blue)',
     //             array('red', 'blue', 'yellow')
     //         );
     //         $question->setMultiselect(true);
     //         $colors = $helper->ask($input, $output, $question);
     //         $output->writeln('You have just selected: ' . implode(', ', $colors));
     //         $bundles = array('AcmeDemoBundle', 'AcmeBlogBundle', 'AcmeStoreBundle');
     //         $question = new Question('Please enter the name of a bundle', 'FooBundle');
     //         $question->setAutocompleterValues($bundles);
     //         $name = $helper->ask($input, $output, $question);
     //         $question = new Question('What is the database password?');
     //         $question->setHidden(true);
     //         $question->setHiddenFallback(false);
     //         $password = $helper->ask($input, $output, $question);
     //         $output->writeln($password);
     // create a new progress bar (50 units)
     //         $progress = new ProgressBar($output, 50);
     //         // start and displays the progress bar
     //         $progress->start();
     //         $i = 0;
     //         while ($i++ < 50) {
     //             // ... do some work
     //             // advance the progress bar 1 unit
     //             $progress->advance();
     // //             sleep(1);
     //             // you can also advance the progress bar by more than 1 unit
     //             // $progress->advance(3);
     //         }
     //         // ensure that the progress bar is at 100%
     //         $progress->finish();
     $table = new Table($output);
     $table->setHeaders(array('ISBN', 'Title', 'Author'))->setRows(array(array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), array('9971-5-0210-0', 'A Tale of Two Cities          ', 'Charles Dickens'), array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'), array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie')));
     $table->setStyle('compact');
     $table->render();
 }
Example #17
0
 /**
  * Sets table layout type.
  *
  * @param int $layout self::LAYOUT_*
  *
  * @return TableHelper
  *
  * @throws \InvalidArgumentException when the table layout is not known
  */
 public function setLayout($layout)
 {
     switch ($layout) {
         case self::LAYOUT_BORDERLESS:
             $this->table->setStyle('borderless');
             break;
         case self::LAYOUT_COMPACT:
             $this->table->setStyle('compact');
             break;
         case self::LAYOUT_DEFAULT:
             $this->table->setStyle('default');
             break;
         default:
             throw new \InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
     }
     return $this;
 }
Example #18
0
 /**
  * @param OutputInterface $output
  * @param array           $rows headers are expected to be the keys of the first row.
  */
 public function render(OutputInterface $output, array $rows)
 {
     $table = new Table($output);
     $table->setStyle(new TableStyle());
     $table->setHeaders(array_keys($rows[0]));
     $table->setRows($rows);
     $table->render();
 }
 protected function dumpTableFormat(OutputInterface $output, array $configLog, $adapter, $style = null)
 {
     $table = new Table($output);
     if (null !== $style) {
         $table->setStyle($style);
     }
     $table->setHeaders($this->getHeaders())->setRows($this->getInfoFromConfigLog($configLog, $adapter));
     $table->render();
 }
Example #20
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $yaml = new Parser();
     $message = $this->getMessageHelper();
     $yaml_left = $input->getArgument('yaml-left');
     $yaml_right = $input->getArgument('yaml-right');
     $stats = $input->getOption('stats');
     $negate = $input->getOption('negate');
     $limit = $input->getOption('limit');
     $offset = $input->getOption('offset');
     if ($negate == 1 || $negate == 'TRUE') {
         $negate = true;
     } else {
         $negate = false;
     }
     try {
         $yaml_left_parsed = $yaml->parse(file_get_contents($yaml_left));
         if (empty($yaml_left_parsed)) {
             $output->writeln('[+] <info>' . sprintf($this->trans('commands.yaml.merge.messages.wrong-parse'), $yaml_left) . '</info>');
         }
         $yaml_right_parsed = $yaml->parse(file_get_contents($yaml_right));
         if (empty($yaml_right_parsed)) {
             $output->writeln('[+] <info>' . sprintf($this->trans('commands.yaml.merge.messages.wrong-parse'), $yaml_right) . '</info>');
         }
     } catch (\Exception $e) {
         $output->writeln('[+] <error>' . $this->trans('commands.yaml.merge.messages.error-parsing') . ': ' . $e->getMessage() . '</error>');
         return;
     }
     $nested_array = $this->getNestedArrayHelper();
     $statisticts = ['total' => 0, 'equal' => 0, 'diff' => 0];
     $diff = $nested_array->arrayDiff($yaml_left_parsed, $yaml_right_parsed, $negate, $statisticts);
     $table = new Table($output);
     $table->setStyle('compact');
     if ($stats) {
         $message->addInfoMessage(sprintf($this->trans('commands.yaml.diff.messages.total'), $statisticts['total']));
         $message->addInfoMessage(sprintf($this->trans('commands.yaml.diff.messages.diff'), $statisticts['diff']));
         $message->addInfoMessage(sprintf($this->trans('commands.yaml.diff.messages.equal'), $statisticts['equal']));
         return;
     }
     // FLAT YAML file to display full yaml to be used with command yaml:update:key or yaml:update:value
     $diff_flatten = array();
     $key_flatten = '';
     $nested_array->yamlFlattenArray($diff, $diff_flatten, $key_flatten);
     if ($limit !== null) {
         if (!$offset) {
             $offset = 0;
         }
         $diff_flatten = array_slice($diff_flatten, $offset, $limit);
     }
     $table->setHeaders([$this->trans('commands.yaml.diff.messages.key'), $this->trans('commands.yaml.diff.messages.value')]);
     foreach ($diff_flatten as $yaml_key => $yaml_value) {
         $table->addRow([$yaml_key, $yaml_value]);
     }
     $table->render();
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var FormatterHelper $formatter */
     $formatter = $this->getHelper('formatter');
     $message = $formatter->formatSection('Section', 'Hello!', 'comment');
     $output->writeln($message);
     $blockMessage = $formatter->formatBlock(['Good luck!'], 'bg=black;fg=white', true);
     $output->writeln($blockMessage);
     /** @var ProcessHelper $processHelper */
     $processHelper = $this->getHelper('process');
     $process = ProcessBuilder::create(['figlet', 'Started!'])->getProcess();
     $processHelper->run($output, $process, 'Something went wrong');
     $finder = new Finder();
     $files = $finder->in(CACHE_PATH)->name('makes*json')->files();
     $progressHelper = new ProgressBar($output);
     $progressHelper->setEmptyBarCharacter('.');
     $progressHelper->setBarCharacter('<comment>+</comment>');
     if ($input->getOption('progress')) {
         $progressHelper->start($files->count());
     }
     $table = new Table($output);
     $table->setStyle('default');
     $style = new TableStyle();
     $style->setBorderFormat('<comment>%s</comment>');
     $table->setStyle($style);
     foreach ($files as $file) {
         /** @var SplFileInfo $file */
         $makes = json_decode($file->getContents(), true);
         $table->setHeaders(['Make Name', 'Models Count']);
         foreach ($makes['makes'] as $make) {
             $table->addRow([$make['name'], count($make['models'])]);
         }
         //            $table->render($output);
         if ($input->getOption('progress')) {
             $progressHelper->advance();
         }
     }
     if ($input->getOption('progress')) {
         $progressHelper->finish();
         $output->writeln('');
     }
 }
Example #22
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $collection = $this->routingParser->getCollection();
     $rows = array();
     foreach ($collection as $route) {
         $rows[] = array(implode('|', $route[0]), $route[1], $route[2]);
     }
     $table = new Table($output);
     $table->setStyle('compact')->setRows($rows);
     $table->render();
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $entries = $this->tableManager->getTable('Phpsx\\Website\\Table\\Release')->getAll(null, null, 'publishedAt', Sql::SORT_DESC);
     $rows = array();
     foreach ($entries as $entry) {
         $rows[] = array($entry['id'], $entry['tagName'], $entry['publishedAt']->format('Y-m-d H:i:s'));
     }
     $table = new Table($output);
     $table->setStyle('compact')->setRows($rows);
     $table->render();
 }
 /**
  * Write records to stdOut (table formatted).
  * @param OutputInterface $output
  * @param array $data
  */
 protected function dumpTable(OutputInterface $output, $data = [])
 {
     $table = new Table($output);
     $table->setStyle('compact');
     foreach ($data as $instance) {
         if ($instance['ip']) {
             $table->addRow([$instance['ip'], $instance['name'], ' # ' . $instance['id']]);
         }
     }
     $table->render();
 }
Example #25
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $route_name = $input->getArgument('route-name');
     $table = new Table($output);
     $table->setStyle('compact');
     if ($route_name) {
         $this->getRouteByNames($route_name, $output, $table);
     } else {
         $this->getAllRoutes($output, $table);
     }
 }
Example #26
0
 /**
  * List all bundled rules
  *
  * @param  RuleCollection  $rules
  * @param  OutputInterface $output
  * @return void
  */
 public function listRules(RuleCollection $rules, OutputInterface $output)
 {
     $table = new Table($output);
     $table->setStyle('compact');
     $table->setHeaders(['Name', 'Description']);
     foreach ($rules as $rule) {
         $table->addRow(['<comment>' . $rule->getName() . '</comment>', $rule->getDescription()]);
     }
     $table->render();
     $output->writeln("\n <info>Use 'psecio-parse rules name-of-rule' for more info about a specific rule</info>");
 }
Example #27
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $theme = $input->getArgument('theme');
     $table = new Table($output);
     $table->setStyle('compact');
     if ($theme) {
         $this->getTheme($theme, $output, $table);
     } else {
         $this->getAllThemes($output, $table);
     }
 }
Example #28
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $resource_id = $input->getArgument('resource-id');
     $status = $input->getOption('authorization');
     $table = new Table($output);
     $table->setStyle('compact');
     if ($resource_id) {
         $this->getRestByID($output, $table, $resource_id);
     } else {
         $this->getAllRestResources($status, $output, $table);
     }
 }
 /**
  * @param \Drupal\Console\Style\DrupalStyle $io
  */
 private function showAllStateKeys(DrupalStyle $io)
 {
     $table = new Table($io);
     $table->setStyle('compact');
     $table->setHeaders([$this->trans('commands.state.debug.messages.key')]);
     $keyValue = $this->getContainer()->get('keyvalue');
     $keyStoreStates = array_keys($keyValue->get('state')->getAll());
     foreach ($keyStoreStates as $key => $keyStoreState) {
         $table->addRow([$keyStoreState]);
     }
     $table->render();
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $passwords = $input->getArgument('password');
     $passHandler = $this->getPassHandler();
     $table = new Table($output);
     $table->setHeaders([$this->trans('commands.user.password.hash.messages.password'), $this->trans('commands.user.password.hash.messages.hash')]);
     $table->setStyle('compact');
     foreach ($passwords as $password) {
         $table->addRow([$password, $passHandler->hash($password)]);
     }
     $table->render();
 }