本文整理汇总了PHP中Symfony\Component\Console\Helper\TableStyle::setCellRowFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP TableStyle::setCellRowFormat方法的具体用法?PHP TableStyle::setCellRowFormat怎么用?PHP TableStyle::setCellRowFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Helper\TableStyle
的用法示例。
在下文中一共展示了TableStyle::setCellRowFormat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int|null|void
*/
public function execute(InputInterface $input, OutputInterface $output)
{
$lists = $this->rfcService->getLists([RfcService::IN_VOTING]);
$rfcs = array_pop($lists);
$table = new Table($output);
$voteStyle = new TableStyle();
$voteStyle->setCellRowFormat('<comment>%s</comment>');
$rfcStyle = new TableStyle();
$rfcStyle->setCellRowFormat('<info>%s</info>');
foreach ($rfcs as $i => $rfcDetails) {
$rfcCode = $rfcDetails[1];
// Build RFC
$rfc = $this->rfcService->getRfc($rfcCode);
$table->addRow([$rfcDetails[0]], $rfcStyle);
$table->addRow(new TableSeparator());
foreach ($rfc->getVotes() as $title => $vote) {
$table->addRow([$title], $voteStyle);
array_shift($vote['counts']);
foreach ($vote['counts'] as $key => $total) {
$table->addRow([$key, $total]);
}
}
if ($rfcDetails !== end($rfcs)) {
$table->addRow(new TableSeparator());
}
}
$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: execute
/**
* Execute Command
*
* @param InputInterface $input
* @param OutputInterface $output
*/
public function execute(InputInterface $input, OutputInterface $output)
{
$sections = ['voting' => RfcService::IN_VOTING, 'discussion' => RfcService::DISCUSSION, 'draft' => RfcService::DRAFT, 'accepted' => RfcService::ACCEPTED, 'declined' => RfcService::DECLINED, 'withdrawn' => RfcService::WITHDRAWN, 'inactive' => RfcService::INACTIVE];
$sections = array_intersect_key($sections, array_filter($input->getOptions()));
if (count($sections) === 0 && !$input->getOption('all')) {
$sections[] = RfcService::IN_VOTING;
}
$table = new Table($output);
$titleStyle = new TableStyle();
$titleStyle->setCellRowFormat('<comment>%s</comment>');
$lists = $this->rfcService->getLists($sections);
$table->setHeaders(['RFC', 'RFC Code']);
foreach ($lists as $heading => $list) {
$table->addRow([$heading], $titleStyle);
$table->addRow(new TableSeparator());
foreach ($list as $listing) {
$table->addRow($listing);
}
if ($list !== end($lists)) {
$table->addRow(new TableSeparator());
}
}
$table->render();
}
示例4: 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();
}
}