src/Debug/Output/Html.php
public function buildTable($rows, $options = array())
    {
        $options = \array_merge(array(
            'attribs' => array(),
            'caption' => null,
            'columns' => array(),
            'totalCols' => array(),
        ), $options);
        if (\is_string($options['attribs'])) {
            $options['attribs'] = array(
                'class' => $options['attribs'],
            );
        }
        if ($this->debug->abstracter->isAbstraction($rows) && $rows['traverseValues']) {
            $options['caption'] .= ' ('.$this->markupClassname(
                $rows['className'],
                'span',
                array(
                    'title' => $rows['phpDoc']['summary'] ?: null,
                )
            ).')';
            $options['caption'] = \trim($options['caption']);
            $rows = $rows['traverseValues'];
        }
        $keys = $options['columns'] ?: $this->debug->methodTable->colKeys($rows);
        $this->tableInfo = array(
            'colClasses' => \array_fill_keys($keys, null),
            'haveObjRow' => false,
            'totals' => \array_fill_keys($options['totalCols'], null),
        );
        $tBody = '';
        foreach ($rows as $k => $row) {
            $tBody .= $this->buildTableRow($row, $keys, $k);
        }
        if (!$this->tableInfo['haveObjRow']) {
            $tBody = \str_replace('<td class="t_classname"></td>', '', $tBody);
        }
        return $this->debug->utilities->buildTag(
            'table',
            $options['attribs'],
            "\n"
                .($options['caption'] ? '<caption>'.$options['caption'].'</caption>'."\n" : '')
                .$this->buildTableHeader($keys)
                .'<tbody>'."\n".$tBody.'</tbody>'."\n"
                .$this->buildTableFooter($keys)
        );
    }
public function buildTable($rows, $options = array())
    {
        $options = \array_merge(array(
            'attribs' => array(),
            'caption' => null,
            'columns' => array(),
            'totalCols' => array(),
        ), $options);
        if (\is_string($options['attribs'])) {
            $options['attribs'] = array(
                'class' => $options['attribs'],
            );
        }
        if ($this->debug->abstracter->isAbstraction($rows) && $rows['traverseValues']) {
            $options['caption'] .= ' ('.$this->markupClassname(
                $rows['className'],
                'span',
                array(
                    'title' => $rows['phpDoc']['summary'] ?: null,
                )
            ).')';
            $options['caption'] = \trim($options['caption']);
            $rows = $rows['traverseValues'];
        }
        $keys = $options['columns'] ?: $this->debug->methodTable->colKeys($rows);
        $this->tableInfo = array(
            'colClasses' => \array_fill_keys($keys, null),
            'haveObjRow' => false,
            'totals' => \array_fill_keys($options['totalCols'], null),
        );
        $tBody = '';
        foreach ($rows as $k => $row) {
            $tBody .= $this->buildTableRow($row, $keys, $k);
        }
        if (!$this->tableInfo['haveObjRow']) {
            $tBody = \str_replace('<td class="t_classname"></td>', '', $tBody);
        }
        return $this->debug->utilities->buildTag(
            'table',
            $options['attribs'],
            "\n"
                .($options['caption'] ? '<caption>'.$options['caption'].'</caption>'."\n" : '')
                .$this->buildTableHeader($keys)
                .'<tbody>'."\n".$tBody.'</tbody>'."\n"
                .$this->buildTableFooter($keys)
        );
    }
Formats an array as a table

@param array $rows    array of \Traversable
@param array $options options
'attribs' : key/val array (or string - interpreted as class value)
'caption' : optional caption
'columns' : array of columns to display (defaults to all)
'totalCols' : array of column keys that will get totaled

@return string