Calculates the total width of the table.

@return int
431115
private function calculateTableWidth(): int
    {
        // Now calculate the total width of the table
        $tableWidth = 0;

        // Add the width of the columns
        foreach ($this->columnsWidths as $width) {
            $tableWidth += $width;
        }

        // Add 1 for the first separator
        $tableWidth += 1;

        // Add the left and right padding * number of columns
        $tableWidth += ($this->options['cells_padding'][1] + $this->options['cells_padding'][3]) * count($this->columnsWidths);

        // Add the left separators
        $tableWidth += count($this->columnsWidths);

        return $tableWidth;
    }
821998
protected function getColumnWidths()
    {
        $first_row = reset($this->data);

        // Create an array with the columns as keys and values of zero
        $column_widths = $this->getDefaultColumnWidths($first_row);

        foreach ($this->data as $columns) {
            foreach ($columns as $key => $column) {
                $column_widths[$key] = $this->getCellWidth($column_widths[$key], $column);
            }
        }

        return $column_widths;
    }
1032042
public static function getLineWidth()
    {
        $min = Config::get('minLineWidth');
        $width = Config::get('maxLineWidth');
        $width -= intval(Config::get('tabWorth'))*intval(Config::get('tabs'));

        if ($width < $min) {
            return $min;
        }

        return $width;
    }
554459
public function count(): int
    {
        $result = $this->getCountQuery()->fetchFirst();

        if ($result === null) {
            return 0;
        }

        return (int)$result['total'];
    }
197832
public function total()
	{
		// Note that we do not need to parse includes at this stage, as includes do not effect
		// the primary result set, and thus do not effect the count. whereRelated() could effect
		// the count, but that method is not currently in use.
		//
		// We also reset the 'select' clause to avoid pulling unnecessary records and reset
		// the 'order by' clause to avoid referenced fields in the aforementioned 'select' clauses
		// that mgiht have been removed. Neither of these should have any effect on a count.
		$first = $this->deselect()
		              ->select($this->getQualifiedFieldName($this->getPrimaryKey()), 'count', true)
		              ->unordered()
		              ->rows(false)
		              ->first();
		              //->count;

		$total = $first ? (int)$first->count : 0;

		$this->reset();

		return $total;
	}
1064842
public function count() {
		$db = DBFactory::getDB($this->data['table']);
		$result = $db->count($this->data['table'], $this->data['where']);
		return intval($result);
	}
1119966
public function get_total()
    {
        if ($this->total) {
            return $this->total;
        }

        $conn = $this->app->getApplicationBox()->get_connection();

        $sql_count = 'SELECT COUNT(DISTINCT Users.id) as total ' . $this->generate_sql_constraints();

        $stmt = $conn->prepare($sql_count);
        $stmt->execute($this->sql_params);
        $row = $stmt->fetch(PDO::FETCH_ASSOC);
        $stmt->closeCursor();

        $this->total = $row['total'];

        $this->page = 1;
        if ($this->total > 0 && is_int($this->offset_start) && is_int($this->results_quantity)) {
            $this->page = floor($this->offset_start / $this->results_quantity) + 1;
            $this->total_page = floor($this->total / $this->results_quantity) + 1;
        }

        return $this->total;
    }
170635
public static function getSingleLineTotalLength()
    {
        $total_length = 0;

        foreach(static::getUiColumns() as $column_name => $prop){
            $key = '_max' . ucfirst(strtolower($column_name)) . 'NameLength';
            $total_length += static::$$key + static::UI_SAFE_LENGTH;
        }

        //keep beauty when show less colums
        !defined('LINE_VERSIOIN_LENGTH') && define('LINE_VERSIOIN_LENGTH', 0);
        $total_length <= LINE_VERSIOIN_LENGTH && $total_length = LINE_VERSIOIN_LENGTH;

        return $total_length;
    }
694223
private function getRemainingColumnWidth(TcTable $table, $width) {
        if (!$this->maxWidth) {
            $margins = $table->getPdf()->getMargins();
            $content_width = $table->getPdf()->getPageWidth() - $margins['left'] - $margins['right'];
        } else {
            $content_width = $this->maxWidth;
        }
        $result = $content_width - (is_array($width) ? array_sum($width) : $width);
        return $result > 0 ? $result : 0;
    }
1152942
protected function columns()
    {
        $this->data    = $this->setData();
        $column_widths = $this->getColumnWidths();
        $output        = [];
        $count         = count(reset($this->data));

        for ($i = 0; $i < $count; $i++) {
            $output[] = $this->getRow($i, $column_widths);
        }

        return $output;
    }
237367
public function getWidths(): array
    {
        $columns = $this->getColumns();
        $values  = ['equal', 'variable', 'null'];
        $values  = array_merge($values, range(1, $columns));

        return array_combine($values, $values);
    }
304772
protected function getTerminalWidth()
    {
        // from environment
        if (isset($_SERVER['COLUMNS'])) return (int)$_SERVER['COLUMNS'];

        // via tput
        $process = proc_open('tput cols', array(
            1 => array('pipe', 'w'),
            2 => array('pipe', 'w'),
        ), $pipes);
        $width = (int)stream_get_contents($pipes[1]);
        proc_close($process);

        return $width;
    }
970112
function recalculate_width()
    {
        $style = $this->get_style();
        $text = $this->get_text();
        $size = $style->font_size;
        $font = $style->font_family;
        $word_spacing = (float)$style->length_in_pt($style->word_spacing);
        $char_spacing = (float)$style->length_in_pt($style->letter_spacing);

        return $style->width = $this->_dompdf->getFontMetrics()->getTextWidth($text, $font, $size, $word_spacing, $char_spacing);
    }
1128190
public function getTableLineSize()
    {
        if ($this->column_size===0 && $this->line_size===0 && $this->cell_size===0) {
            $this->_parseTableSizes();
        }
        return $this->line_size;
    }
1015926
public function calculate_auto_width()
    {
        $width = 0;

        foreach ($this->_frame->get_children() as $child) {
            if ($child->get_original_style()->width == 'auto') {
                $width += $child->calculate_auto_width();
            } else {
                $width += $child->get_margin_width();
            }
        }

        $this->_frame->get_style()->width = $width;

        return $this->_frame->get_margin_width();
    }
776506
protected function getColumnWidths()
    {
        $column_widths = [];

        for ($i = 0; $i < $this->column_count; $i++) {
            if (!isset($this->data[$i])) {
                $column_widths[] = 0;
                continue;
            }
            $column_widths[] = $this->getColumnWidth($this->data[$i]);
        }

        return $column_widths;
    }
485469
public function size()
	{
		if ($this->is_empty())
			return 0;

		$count = 0;

		foreach ($this->errors as $attribute => $error)
			$count += count($error);

		return $count;
	}