Phosphorum\Markdown\TableExtension::createView PHP Method

createView() protected method

protected createView ( Ciconia\Common\Collection $headerCells, Ciconia\Common\Collection $bodyRows ) : Ciconia\Common\Text
$headerCells Ciconia\Common\Collection
$bodyRows Ciconia\Common\Collection
return Ciconia\Common\Text
    protected function createView(Collection $headerCells, Collection $bodyRows)
    {
        $tHeadRow = new Tag('tr');
        $tHeadRow->setText("\n" . $headerCells->join("\n") . "\n");
        $tHead = new Tag('thead');
        $tHead->setText("\n" . $tHeadRow . "\n");
        $tBody = new Tag('tbody');
        $bodyRows->apply(function (Collection $row) use(&$options) {
            $tr = new Tag('tr');
            $tr->setText("\n" . $row->join("\n") . "\n");
            return $tr;
        });
        $tBody->setText("\n" . $bodyRows->join("\n") . "\n");
        $table = new Tag('table');
        $table->setAttributes(['class' => 'table']);
        $table->setText("\n" . $tHead . "\n" . $tBody . "\n");
        return new Text($table->render());
    }