Returns the number of columns of the terminal.

@return int
@codeCoverageIgnore
15281
public static function getNumberOfColumns(): int
    {
        if (DIRECTORY_SEPARATOR === '\\') {
            $columns = 80;

            if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
                $columns = $matches[1];
            } elseif (function_exists('proc_open')) {
                $process = proc_open(
                    'mode CON',
                    [
                        1 => ['pipe', 'w'],
                        2 => ['pipe', 'w'],
                    ],
                    $pipes,
                    null,
                    null,
                    ['suppress_errors' => true]
                );

                if (is_resource($process)) {
                    $info = stream_get_contents($pipes[1]);
                    fclose($pipes[1]);
                    fclose($pipes[2]);
                    proc_close($process);
                    if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
                        $columns = $matches[2];
                    }
                }
            }

            return $columns - 1;
        }

        if (!self::isInteractive(self::STDIN)) {
            return 80;
        }

        if (preg_match('#\d+ (\d+)#', shell_exec('stty size'), $match) === 1) {
            if ((int)$match[1] > 0) {
                return (int)$match[1];
            }
        }

        if (preg_match('#columns = (\d+);#', shell_exec('stty'), $match) === 1) {
            if ((int)$match[1] > 0) {
                return (int)$match[1];
            }
        }

        return 80;
    }
798449
public function getColumns()
    {
        if (!$this->columns && $this->length()) {
            if ($this->first() instanceof DataInterface) {
                $this->columns = array_keys($this->first()->toArray());
            } elseif (is_array($this->first())) {
                $this->columns = array_keys($this->first());
            }
        }

        return $this->columns;
    }
991295
private function count()
    {
        $qb = clone $this->queryBuilder;
        $this->resetSqlParts($qb, ['orderBy'])
            ->setFirstResult(null)
            ->setMaxResults(null);
        $connection = $qb->getConnection();
        $sql = sprintf("SELECT COUNT(*) FROM (%s) _sps_cnt_", $qb->getSQL());
        $stmt = $connection->executeQuery($sql, $qb->getParameters(), $this->parametersTypes);
        $this->totalResultCount = $stmt->fetchColumn();

        return $this->totalResultCount;
    }
206240
public function count()
	{
		if (!empty($this->cursor) && $this->cursor instanceof \PDOStatement)
		{
			return $this->cursor->rowCount();
		}
		else
		{
			return 0;
		}
	}
1174853
protected int getNumOfCols() {
        if (!columns.isEmpty()) return getHeadRegularColCnt() + columns.size();
        if (loaded && !colTitleWidgets.isEmpty()) return getHeadRegularColCnt() + colTitleWidgets.size();
        return getHeadRegularColCnt();
    }
515727
public function getColumnNames()
    {
        $columns = array();
        foreach ($this->childs as $column) {
            $columns[] = $column->getColumnName();
        }

        return $columns;
    }
1326634
public function columnCount()
    {
        if(empty($this->_resultData) || empty($this->_resultData->result)){
            return 0;
        }

        return count(@$this->_resultData->result[0]);
    }
176319
public function count()
    {
        $self         = clone $this;
        $self->type   = 'select';
        $self->select = ['COUNT(*) AS cnt'];
        $result       = $self->execute();
        return count($result[0]) > 0 ? (int) $result[0]['cnt'] : 0;
    }
988253
private function getLineWidth()
    {
        $line_width = isset($_ENV['COLUMNS']) && $_ENV['COLUMNS']
                    ? $_ENV['COLUMNS']
                    : 0;

        if ($line_width === 0) {
            $line_width = exec('tput cols');
        }

        return $line_width;
    }
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;
    }
637942
public function count()
    {
        if ($this->_count !== null) {
            return $this->_count;
        }
        if ($this->_statement) {
            return $this->_count = $this->_statement->rowCount();
        }

        if ($this->_results instanceof SplFixedArray) {
            $this->_count = $this->_results->count();
        } else {
            $this->_count = count($this->_results);
        }

        return $this->_count;
    }
1037198
public function getTerminalWidth()
    {
        if ($this->isInteractiveShell()
            || (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && getenv('shell'))
        ) {
            return (int)shell_exec('tput cols');
        }

        return self::TERMINAL_DEFAULT_WIDTH;
    }
940805
public function colorLiteCommand(): int
    {
        if (!$this->output->supportColor()) {
            $this->write('Current terminal is not support output color text.');
            return -2;
        }

        $this->output->startBuffer();

        foreach (Color::getStyles() as $style) {
            $this->output->write(Color::render("color text(style:$style)", $style));
        }

        $this->output->flush();

        return 0;
    }
679158
def num_columns(self):
        """"""
        if self.term.is_a_tty:
            return self.term.width // self.hint_width
        return 1
752268
public function getColumn(){

		$part = substr($this->input, 0, $this->index);
		$pos = strrpos($part,"\n");
		return $this->index - $pos;
	}
614201
public function getNumLazyLoadColumns()
    {
        $count = 0;
        foreach ($this->columnList as $col) {
            if ($col->isLazyLoad()) {
                $count++;
            }
        }

        return $count;
    }
1254770
public function count()
    {
        $select = clone $this->select;
        $select->reset(Select::COLUMNS);
        $select->columns([
            'c' => $this->raw('COUNT(*)')
        ]);
        
        $rows = $this->loadRecords($select);
        if (isset($rows[0]['c'])) {
            return (int)$rows[0]['c'];
        }
        
        return false;
    }