本文整理汇总了PHP中Symfony\Component\Console\Helper\TableStyle::setCellHeaderFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP TableStyle::setCellHeaderFormat方法的具体用法?PHP TableStyle::setCellHeaderFormat怎么用?PHP TableStyle::setCellHeaderFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Helper\TableStyle
的用法示例。
在下文中一共展示了TableStyle::setCellHeaderFormat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayErrors
/**
* Display validation errors.
*
* @param Validator $validator The json-schema validator.
* @param OutputInterface $output An OutputInterface instance.
*/
public static function displayErrors(Validator $validator, OutputInterface $output)
{
$table = new Table($output);
$style = new TableStyle();
$style->setCellHeaderFormat('<error>%s</error>');
$style->setHorizontalBorderChar(' ');
$style->setVerticalBorderChar(' ');
$style->setCrossingChar(' ');
$table->setHeaders(['Property', 'Error']);
$table->setRows($validator->getErrors());
$table->setStyle($style);
$table->render();
}
示例2: doExecute
/**
* {@inheritDoc}
*/
protected function doExecute()
{
$table = new Table($this->output);
$table->setHeaders(['Name', 'Description']);
$style = new TableStyle();
$style->setCellHeaderFormat('<fg=red>%s</fg=red>');
$style->setCellRowFormat('<fg=blue>%s</fg=blue>');
$style->setBorderFormat('<fg=yellow>%s</fg=yellow>');
$table->setStyle($style);
/** @type AbstractTask[] $services */
$services = $this->container->get('bldr.registry.task')->findAll();
foreach ($services as $service) {
if ($service instanceof AbstractTask) {
$service->configure();
}
$table->addRow([$service->getName(), $service->getDescription() !== '' ? $service->getDescription() : 'No Description']);
}
$table->render($this->output);
}
示例3: doExecute
/**
* {@inheritDoc}
*/
protected function doExecute()
{
/** @type AbstractTask $service */
$service = $this->container->get('bldr.registry.task')->findTaskByType($this->input->getArgument('task'));
$this->output->writeln('');
$this->output->writeln('<fg=green>Task Name</fg=green>: ' . $service->getName());
if ($service->getDescription() !== null) {
$this->output->writeln('<fg=green>Task Description</fg=green>: ' . $service->getDescription());
}
if ($service instanceof AbstractTask) {
$this->output->writeln(['', '<fg=green>Options:</fg=green>']);
$tableHelper = new Table($this->output);
$style = new TableStyle();
$style->setCellHeaderFormat('<fg=red>%s</fg=red>');
$style->setCellRowFormat('<fg=blue>%s</fg=blue>');
$style->setBorderFormat('<fg=yellow>%s</fg=yellow>');
$tableHelper->setStyle($style);
$tableHelper->setHeaders(['Option', 'Description', 'Required', "Default"]);
foreach ($service->getParameterDefinition() as $option) {
$tableHelper->addRow([$option['name'], $option['description'] !== '' ? $option['description'] : 'No Description', $option['required'] ? 'Yes' : 'No', json_encode($option['default'])]);
}
$tableHelper->render();
}
}
示例4: table
/**
* @param string[] $rows
* @param string[] $headers
*/
public function table(array $rows, array $headers = null)
{
$rows = array_map(function ($value) {
if (!is_array($value)) {
return $value;
}
$header = array_shift($value);
array_unshift($value, sprintf('<fg=blue>%s</>', $header));
return $value;
}, $rows);
$style = new TableStyle();
$style->setVerticalBorderChar('<fg=blue>|</>');
$style->setHorizontalBorderChar('<fg=blue>-</>');
$style->setCrossingChar('<fg=blue>+</>');
$style->setCellHeaderFormat('%s');
$table = new Table($this);
$table->setStyle($style);
if ($headers) {
$table->setHeaders($headers);
}
$table->setRows($rows);
$table->render();
$this->newLine();
}