public function render(IO $io, $indentation = 0)
{
// Is the table empty?
if (!$this->rows) {
return;
}
$screenWidth = $io->getTerminalDimensions()->getWidth();
$excessColumnWidth = max(StringUtil::getLength(sprintf($this->style->getHeaderCellFormat(), ''), $io), StringUtil::getLength(sprintf($this->style->getCellFormat(), ''), $io));
$wrapper = $this->getCellWrapper($io, $screenWidth, $excessColumnWidth, $indentation);
$this->renderRows($io, $wrapper->getWrappedRows(), $wrapper->getColumnLengths(), $excessColumnWidth, $indentation);
}
public function handleList(Args $args, IO $io) { $table = new Table(PuliTableStyle::borderless()); $table->setHeaderRow(array('Name', 'Class', 'Description')); foreach ($this->installerManager->getInstallerDescriptors() as $descriptor) { $className = $descriptor->getClassName(); if (!$args->isOptionSet('long')) { $className = StringUtil::getShortClassName($className); } $parameters = array(); foreach ($descriptor->getParameters() as $parameterName => $parameter) { if (!$parameter->isRequired()) { $parameterName .= '=' . StringUtil::formatValue($parameter->getDefaultValue()); } $parameters[] = $parameterName; } $description = $descriptor->getDescription(); if (!empty($parameters)) { // non-breaking space $description .= ' <c1>(' . implode(", ", $parameters) . ')</c1>'; } $table->addRow(array('<u>' . $descriptor->getName() . '</u>', '<c1>' . $className . '</c1>', $description)); } $table->render($io); return 0; }