private function calculateSizes()
    {
        // For each row...
        foreach ($this->data as $rowPosition => $rowContent) {
            // ... cycle each column to get its content ...
            foreach ($rowContent as $columnName => $cellContent) {
                // If we don't already know the height of this row...
                if (false === isset($this->rowsHeights[$rowPosition])) {
                    // ... we save the current calculated height
                    $this->rowsHeights[$rowPosition] = count($cellContent);
                }

                // Set the min_width if it is set
                if (isset($this->options['columns'][$columnName]['min_width'])) {
                    $this->columnsWidths[$columnName] = $this->options['columns'][$columnName]['min_width'];
                }

                // At this point we have the heigth for sure: on each cycle, we need the highest height
                if (count($cellContent) > $this->rowsHeights[$rowPosition]) {
                    /*
                     * The height of this row is the highest found: use this to set the height of the entire row.
                     */
                    $this->rowsHeights[$rowPosition] = count($cellContent);
                }

                // ... and calculate the length of each line to get the max length of the column
                foreach ($cellContent as $lineNumber => $lineContent) {
                    // Get the length of the cell
                    $contentLength = iconv_strlen($lineContent);

                    // If we don't already have a length for this column...
                    if (false === isset($this->columnsWidths[$columnName])) {
                        // ... we save the current calculated length
                        $this->columnsWidths[$columnName] = $contentLength;
                    }

                    // At this point we have a length for sure: on each cycle we need the longest length
                    if ($contentLength > $this->columnsWidths[$columnName]) {
                        /*
                         * The length of the content of this cell is longer than the value we already have.
                         * So we need to use this new value as length for the current column.
                         */
                        $this->columnsWidths[$columnName] = $contentLength;
                    }
                }
            }
        }
    }
private function calculateSizes()
    {
        // For each row...
        foreach ($this->data as $rowPosition => $rowContent) {
            // ... cycle each column to get its content ...
            foreach ($rowContent as $columnName => $cellContent) {
                // If we don't already know the height of this row...
                if (false === isset($this->rowsHeights[$rowPosition])) {
                    // ... we save the current calculated height
                    $this->rowsHeights[$rowPosition] = count($cellContent);
                }

                // Set the min_width if it is set
                if (isset($this->options['columns'][$columnName]['min_width'])) {
                    $this->columnsWidths[$columnName] = $this->options['columns'][$columnName]['min_width'];
                }

                // At this point we have the heigth for sure: on each cycle, we need the highest height
                if (count($cellContent) > $this->rowsHeights[$rowPosition]) {
                    /*
                     * The height of this row is the highest found: use this to set the height of the entire row.
                     */
                    $this->rowsHeights[$rowPosition] = count($cellContent);
                }

                // ... and calculate the length of each line to get the max length of the column
                foreach ($cellContent as $lineNumber => $lineContent) {
                    // Get the length of the cell
                    $contentLength = iconv_strlen($lineContent);

                    // If we don't already have a length for this column...
                    if (false === isset($this->columnsWidths[$columnName])) {
                        // ... we save the current calculated length
                        $this->columnsWidths[$columnName] = $contentLength;
                    }

                    // At this point we have a length for sure: on each cycle we need the longest length
                    if ($contentLength > $this->columnsWidths[$columnName]) {
                        /*
                         * The length of the content of this cell is longer than the value we already have.
                         * So we need to use this new value as length for the current column.
                         */
                        $this->columnsWidths[$columnName] = $contentLength;
                    }
                }
            }
        }
    }
private function calculateSizes ( ) { // For each row... foreach ( $ this -> data as $ rowPosition => $ rowContent ) { // ... cycle each column to get its content ... foreach ( $ rowContent as $ columnName => $ cellContent ) { // If we don't already know the height of this row... if ( false === isset ( $ this -> rowsHeights [ $ rowPosition ] ) ) { // ... we save the current calculated height $ this -> rowsHeights [ $ rowPosition ] = count ( $ cellContent ) ; } // Set the min_width if it is set if ( isset ( $ this -> options [ 'columns' ] [ $ columnName ] [ 'min_width' ] ) ) { $ this -> columnsWidths [ $ columnName ] = $ this -> options [ 'columns' ] [ $ columnName ] [ 'min_width' ] ; } // At this point we have the heigth for sure: on each cycle, we need the highest height if ( count ( $ cellContent ) > $ this -> rowsHeights [ $ rowPosition ] ) { /*
                     * The height of this row is the highest found: use this to set the height of the entire row.
                     */ $ this -> rowsHeights [ $ rowPosition ] = count ( $ cellContent ) ; } // ... and calculate the length of each line to get the max length of the column foreach ( $ cellContent as $ lineNumber => $ lineContent ) { // Get the length of the cell $ contentLength = iconv_strlen ( $ lineContent ) ; // If we don't already have a length for this column... if ( false === isset ( $ this -> columnsWidths [ $ columnName ] ) ) { // ... we save the current calculated length $ this -> columnsWidths [ $ columnName ] = $ contentLength ; } // At this point we have a length for sure: on each cycle we need the longest length if ( $ contentLength > $ this -> columnsWidths [ $ columnName ] ) { /*
                         * The length of the content of this cell is longer than the value we already have.
                         * So we need to use this new value as length for the current column.
                         */ $ this -> columnsWidths [ $ columnName ] = $ contentLength ; } } } } }
Calculates the width of each column of the table.
Calculates the width of each column of the table .