public function render(array $rows, array $header = [], $defaultColumns = [])
    {
        $format = $this->getFormat();

        $columnsToDisplay = $this->columnsToDisplay() ?: $defaultColumns;
        $rows = $this->filterColumns($rows, $header, $columnsToDisplay);
        $header = $this->filterColumns([0 => $header], $header, $columnsToDisplay)[0];

        if ($this->input->hasOption('no-header') && $this->input->getOption('no-header')) {
            $header = [];
        }

        switch ($format) {
            case 'csv':
                $this->renderCsv($rows, $header);
                break;

            case 'tsv':
                $this->renderCsv($rows, $header, "\t");
                break;

            case null:
            case 'table':
                $this->renderTable($rows, $header);
                break;

            default:
                throw new InvalidArgumentException(sprintf('Invalid format: %s', $format));
        }
    }
public function render(array $rows, array $header = [], $defaultColumns = [])
    {
        $format = $this->getFormat();

        $columnsToDisplay = $this->columnsToDisplay() ?: $defaultColumns;
        $rows = $this->filterColumns($rows, $header, $columnsToDisplay);
        $header = $this->filterColumns([0 => $header], $header, $columnsToDisplay)[0];

        if ($this->input->hasOption('no-header') && $this->input->getOption('no-header')) {
            $header = [];
        }

        switch ($format) {
            case 'csv':
                $this->renderCsv($rows, $header);
                break;

            case 'tsv':
                $this->renderCsv($rows, $header, "\t");
                break;

            case null:
            case 'table':
                $this->renderTable($rows, $header);
                break;

            default:
                throw new InvalidArgumentException(sprintf('Invalid format: %s', $format));
        }
    }
public function render ( array $ rows , array $ header = [ ] , $ defaultColumns = [ ] ) { $ format = $ this -> getFormat ( ) ; $ columnsToDisplay = $ this -> columnsToDisplay ( ) ? : $ defaultColumns ; $ rows = $ this -> filterColumns ( $ rows , $ header , $ columnsToDisplay ) ; $ header = $ this -> filterColumns ( [ 0 => $ header ] , $ header , $ columnsToDisplay ) [ 0 ] ; if ( $ this -> input -> hasOption ( 'no-header' ) && $ this -> input -> getOption ( 'no-header' ) ) { $ header = [ ] ; } switch ( $ format ) { case 'csv' : $ this -> renderCsv ( $ rows , $ header ) ; break ; case 'tsv' : $ this -> renderCsv ( $ rows , $ header , "\t" ) ; break ; case null : case 'table' : $ this -> renderTable ( $ rows , $ header ) ; break ; default : throw new InvalidArgumentException ( sprintf ( 'Invalid format: %s' , $ format ) ) ; } }
Render a table of data to output.

@param array $rows
The table rows.
@param string[] $header
The table header (optional).
@param string[] $defaultColumns
Default columns to display (optional). Columns are identified by
their name in $header, or alternatively by their key in $rows.
Render a table of data to output .