Analysers reports used the Symfony 2.5 Console Table Component

Data and render were separated on each analyser reports.

While in previous verson 3.x, I’ve introduced a forked
of Symfony Console TableHelper (with footer support), today CompatInfo 3.2 will used the new Symfony 2.5 Console Table Helper.

As mentionned by Symfony Team, the Table Helper was deprecated in Symfony 2.5 and will be removed in Symfony 3.0.

We have two challenges to solve here :

  • introduces again the footer behavior

  • let each analyser choose to render results

For the first challenge, here are the code used to simulate a footer.


use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableSeparator;

$table = new Table($output);
    ->setHeaders(array('ISBN', 'Title', 'Author'))
        array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
        array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
        array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'),
        array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
        new TableSeparator(),
        array('<info>Footer col.1</info>','<info>Footer col.2</info>','<info>Footer col.3</info>'),

that will render something like :

default style
changes the default style to compact

that will render something like :

compact style
changes the default style to borderless

that will render something like :

borderless style
Published by Laurent Laville on 2014-07-08