本文整理汇总了PHP中Symfony\Component\Console\Helper\TableStyle::setBorderFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP TableStyle::setBorderFormat方法的具体用法?PHP TableStyle::setBorderFormat怎么用?PHP TableStyle::setBorderFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Helper\TableStyle
的用法示例。
在下文中一共展示了TableStyle::setBorderFormat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: execute
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('');
}
}
开发者ID:GrizliK1988,项目名称:symfony-certification-prepare-project,代码行数:42,代码来源:MakesCacheReportCommand.php
示例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();
}
}