Symfony\Component\Console\Style\SymfonyStyle::table PHP Méthode

table() public méthode

public table ( array $headers, array $rows )
$headers array
$rows array
    public function table(array $headers, array $rows)
    {
        $style = clone Table::getStyleDefinition('symfony-style-guide');
        $style->setCellHeaderFormat('<info>%s</info>');

        $table = new Table($this);
        $table->setHeaders($headers);
        $table->setRows($rows);
        $table->setStyle($style);

        $table->render();
        $this->newLine();
    }

Usage Example

 public function writeErrorReports(array $errorReports)
 {
     foreach ($errorReports as $file => $errors) {
         $this->symfonyStyle->section('FILE: ' . $file);
         $tableRows = $this->formatErrorsToTableRows($errors);
         $this->symfonyStyle->table(['Line', 'Error', 'Sniff Code', 'Fixable'], $tableRows);
         $this->symfonyStyle->newLine();
     }
 }
All Usage Examples Of Symfony\Component\Console\Style\SymfonyStyle::table