public function render(array $options = []): string
    {
        // Set the options to use
        $this->resolveOptions($options);

        if (false === $this->validate()) {
            return false;
        }

        // Splits the content of the cells to fit into the defined line length
        $this->splitCellsContent();

        /*
         * Calculate the height of each row and the width of each column.
         * The height is equal to highest cell content found in the row.
         * The width is equal to the longest line found in the content of each cell of the column.
         */
        $this->calculateSizes();

        $this->tableWidth = $this->calculateTableWidth();

        $table = $this->options['has_header'] ? $this->drawHeaderDivider() : $this->drawDivider();

        // If the top divider of the header hasn't to be shown...
        if ($this->options['has_header'] && false === $this->options['show_head_top_sep']) {
            // ... Remove it
            $table = '';
        }

        foreach ($this->data as $rowPosition => $rowContent) {
            $table .= $this->drawRow($rowPosition, $rowContent);
            $table .= $this->options['has_header'] && 0 === $rowPosition ? $this->drawHeaderDivider() : $this->drawDivider();
        }

        $this->table = $table;

        // Reset options
        $this->options = [];

        return $this->table;
    }
public function render(array $options = []): string
    {
        // Set the options to use
        $this->resolveOptions($options);

        if (false === $this->validate()) {
            return false;
        }

        // Splits the content of the cells to fit into the defined line length
        $this->splitCellsContent();

        /*
         * Calculate the height of each row and the width of each column.
         * The height is equal to highest cell content found in the row.
         * The width is equal to the longest line found in the content of each cell of the column.
         */
        $this->calculateSizes();

        $this->tableWidth = $this->calculateTableWidth();

        $table = $this->options['has_header'] ? $this->drawHeaderDivider() : $this->drawDivider();

        // If the top divider of the header hasn't to be shown...
        if ($this->options['has_header'] && false === $this->options['show_head_top_sep']) {
            // ... Remove it
            $table = '';
        }

        foreach ($this->data as $rowPosition => $rowContent) {
            $table .= $this->drawRow($rowPosition, $rowContent);
            $table .= $this->options['has_header'] && 0 === $rowPosition ? $this->drawHeaderDivider() : $this->drawDivider();
        }

        $this->table = $table;

        // Reset options
        $this->options = [];

        return $this->table;
    }
public function render ( array $ options = [ ] ) : string { // Set the options to use $ this -> resolveOptions ( $ options ) ; if ( false === $ this -> validate ( ) ) { return false ; } // Splits the content of the cells to fit into the defined line length $ this -> splitCellsContent ( ) ; /*
         * Calculate the height of each row and the width of each column.
         * The height is equal to highest cell content found in the row.
         * The width is equal to the longest line found in the content of each cell of the column.
         */ $ this -> calculateSizes ( ) ; $ this -> tableWidth = $ this -> calculateTableWidth ( ) ; $ table = $ this -> options [ 'has_header' ] ? $ this -> drawHeaderDivider ( ) : $ this -> drawDivider ( ) ; // If the top divider of the header hasn't to be shown... if ( $ this -> options [ 'has_header' ] && false === $ this -> options [ 'show_head_top_sep' ] ) { // ... Remove it $ table = '' ; } foreach ( $ this -> data as $ rowPosition => $ rowContent ) { $ table .= $ this -> drawRow ( $ rowPosition , $ rowContent ) ; $ table .= $ this -> options [ 'has_header' ] && 0 === $ rowPosition ? $ this -> drawHeaderDivider ( ) : $ this -> drawDivider ( ) ; } $ this -> table = $ table ; // Reset options $ this -> options = [ ] ; return $ this -> table ; }
Renders the table as plain text.

@param array $options

@return string
Renders the table as plain text .