/** * @param Project $project * @param OutputInterface $output * * @return int */ protected function listProperties(Project $project, OutputInterface $output) { $output->writeln("Metadata for the project <info>" . $project['id'] . "</info>:"); $table = new Table($output); $table->setHeaders(array("Property", "Value")); foreach ($project->getProperties() as $key => $value) { if (is_scalar($value)) { $table->addRow(array($key, $value)); } } $table->render(); return 0; }
/** * @param Project $project * @param OutputInterface $output * * @return int */ protected function listProperties(Project $project, OutputInterface $output) { $this->stdErr->writeln("Metadata for the project <info>" . $project['id'] . "</info>:"); // Properties not to display, as they are internal, deprecated, or // otherwise confusing. $blacklist = array('name', 'cluster', 'cluster_label', 'license_id', 'plan', '_endpoint', 'repository', 'subscription'); $table = new Table($output); $table->setHeaders(array("Property", "Value")); foreach ($project->getProperties() as $key => $value) { if (!in_array($key, $blacklist)) { $value = $this->formatter->format($value, $key); $value = wordwrap($value, 50, "\n", true); $table->addRow(array($key, $value)); } } $table->render(); return 0; }
/** * @param Project $project * @param Table $table * * @return int */ protected function listProperties(Project $project, Table $table) { // Properties not to display, as they are internal, deprecated, or // otherwise confusing. $blacklist = ['name', 'cluster', 'cluster_label', 'license_id', 'plan', '_endpoint', 'repository', 'subscription']; $headings = []; $values = []; foreach ($project->getProperties() as $key => $value) { if (!in_array($key, $blacklist)) { $value = $this->formatter->format($value, $key); $value = wordwrap($value, 50, "\n", true); $headings[] = $key; $values[] = $value; } } $table->renderSimple($values, $headings); return 0; }