protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output) { $table = new Console\Helper\TableHelper(); $output->writeln('Cluster overview:'); $output->writeln(''); $output->writeln('Nodes:'); $cluster = $this->elastica->getCluster(); $table->setHeaders(['name', 'documents', 'node', 'ip', 'port', 'hostname', 'version', 'transport address', 'http address']); $nodes = $cluster->getNodes(); foreach ($nodes as $node) { $name = $node->getName(); $ip = $node->getInfo()->getIp(); $data = $node->getInfo()->getData(); $port = $node->getInfo()->getPort(); $stats = $node->getStats()->get(); $table->addRow([$data['name'], $stats['indices']['docs']['count'], $name, $ip, $port, $data['hostname'], $data['version'], $data['transport_address'], $data['http_address']]); } $table->render($output); $table->setRows([]); /* INFO */ $info = $this->elastica->request('', 'GET')->getData(); $table->setHeaders(['name', 'version', 'status', 'ok']); $table->addRow([$info['name'], $info['version']['number'], $info['status'], $info['ok']]); $table->render($output); $table->setRows([]); $output->writeln(''); }
/** * Construct an ASCII table to display services. * * @param array $services * @return TableHelper */ public function buildServiceTable($services) { $table = new TableHelper(); $table->setHeaders($this->buildTableHeaders()); $table->setRows($this->buildTableRows($services)); return $table; }
/** * Display the results of calls in table format * * @param TableHelper $table * @param mixed $results * @param OutputInterface $output * * @return string */ public function displayTable(TableHelper $table, $results, OutputInterface $output) { $table->setHeaders(['Start Time', 'From', 'To', 'Status', 'Call ID']); $rows = $this->buildRows($results); if (!empty($rows)) { $table->setRows($rows); } $table->render($output); }
/** * @param OutputInterface $output */ public function render(OutputInterface $output) { if (empty($this->issues)) { return; } foreach ($this->issues as $file => $issues) { $output->writeln(PHP_EOL . $file); $this->tableHelper->setHeaders($this->config['displayed-columns']); foreach ($issues as $issue) { if (empty($this->config['displayed-columns']['source']) || empty($issue['source'])) { $this->renderIssue($issue); } else { $this->renderIssueWithSource($issue); } } $this->tableHelper->render($output); $this->tableHelper->setRows(array()); } }
public function dumpToConsole(OutputInterface $output, TableHelper $table) { $table->setHeaders(array('Entity Type', 'Bundle', 'Label', 'Description')); /** @var $node AbstractEntityTypeBuilder */ foreach ($this->entityTypes as $entity) { $rows[] = array($entity->getEntityType(), $entity->getBundle(), $entity->getLabel(), $entity->getDescription()); } $table->setRows($rows); $rows = array(); $table->render($output); $table->setHeaders(array('Field Name', 'Field Type')); /** @var $field FieldBuilder */ foreach ($this->fields as $field) { $rows[] = array($field->getName(), $field->getType()); } $table->setRows($rows); $table->render($output); $rows = array(); $table->setHeaders(array('Entity', 'Field', 'Label', 'Widget')); /** @var $instance AttachedInstanceBuilder */ foreach ($this->instances as $instance) { $rows[] = array($instance->getEntityType() . ':' . $instance->getBundle(), $instance->getFieldName(), $instance->getLabel(), $instance->getWidget()->getType()); } $table->setRows($rows); $table->render($output); }