You are here

public function SymfonyStyle::table in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Style/SymfonyStyle.php \Symfony\Component\Console\Style\SymfonyStyle::table()

Formats a table.

Parameters

array $headers:

array $rows:

Overrides StyleInterface::table

File

vendor/symfony/console/Style/SymfonyStyle.php, line 205

Class

SymfonyStyle
Output decorator helpers for the Symfony Style Guide.

Namespace

Symfony\Component\Console\Style

Code

public function table(array $headers, array $rows) {
  $headers = array_map(function ($value) {
    return sprintf('<info>%s</>', $value);
  }, $headers);
  $table = new Table($this);
  $table
    ->setHeaders($headers);
  $table
    ->setRows($rows);
  $table
    ->setStyle('symfony-style-guide');
  $table
    ->render();
  $this
    ->newLine();
}