Returns an estimated number of columns for the given maximum width.

@param int $maxTotalWidth The maximum total width of the columns.

@return int The estimated number of columns.
346225
public function getEstimatedNbColumns($maxTotalWidth)
    {
        $i = 0;
        $rowWidth = 0;

        while (isset($this->cells[$i])) {
            $rowWidth += StringUtil::getLength($this->cells[$i]);

            if ($rowWidth > $maxTotalWidth) {
                // Return previous number of columns
                return $i;
            }

            ++$i;
        }

        return $i;
    }
147296
def width_max(self, width_max):
        
        if width_max is None:
            self._width_limits[1] = None
            return

        width_max = float(width_max)
        assert(self.width_min <= width_max)

        self._width_limits[1] = width_max
        self._update_layout()
576977
private function getNumberOfColumns()
    {
        if (null !== $this->numberOfColumns) {
            return $this->numberOfColumns;
        }

        $columns = [\count($this->headers)];
        foreach ($this->rows as $row) {
            $columns[] = \count($row);
        }

        return $this->numberOfColumns = \max($columns);
    }
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;
    }
544804
public function getWidth()
    {
        if ($this->width === null) {
            $this->width = intval($this->systemCall('tput cols'));
        }

        return $this->width;
    }
863848
private function getMaxSize(array $filterSetNames)
    {
        $maxWidth = $maxHeight = 0;

        foreach ($filterSetNames as $filterSetName) {
            list($width, $height) = $this->getSize($filterSetName);

            if ($width > $maxWidth) {
                $maxWidth = $width;
            }
            if ($height > $maxHeight) {
                $maxHeight = $height;
            }
        }

        return [$maxWidth, $maxHeight];
    }
252979
public function setColumnWidthLimits($minWidth = null, $maxWidth = null)
    {
        $this->minColumnWidth = is_numeric($minWidth) && $minWidth >= 0 ? $minWidth : 0;
        $this->maxColumnWidth = is_numeric($maxWidth) && $maxWidth < 255.86 ? $maxWidth : 255.86;
    }
910539
public function getLastWidth($mode = false)
    {
        for ($k=count($this->table)-1; $k>=0; $k--) {
            if ($this->table[$k]['width']) {
                $w = $this->table[$k]['width'];
                if ($mode) {
                    $w+= $this->table[$k]['border']['l']['width'] + $this->table[$k]['padding']['l'] + 0.02;
                    $w+= $this->table[$k]['border']['r']['width'] + $this->table[$k]['padding']['r'] + 0.02;
                }
                return $w;
            }
        }
        return $this->_pdf->getW() - $this->_pdf->getlMargin() - $this->_pdf->getrMargin();
    }
742638
public function setDimension($maxWidth, $maxHeight)
    {
      if ( (int) $maxWidth && (int) $maxHeight) {
        $this->dimensions = array($maxWidth, $maxHeight);
      } else {
        $this->error = $this->commonUploadErrors[$this->language]['ERROR_03'];
      }

      return $this;
    }
963507
private function getMaxWidth()
    {
        $max = 0;

        foreach ($this->getOptions() as $option) {
            $nameLength = \strlen($option->getName()) + 2;
            if ($option->getShortcut()) {
                $nameLength += \strlen($option->getShortcut()) + 3;
            }

            $max = \max($max, $nameLength);
        }

        foreach ($this->getArguments() as $argument) {
            $max = \max($max, \strlen($argument->getName()));
        }

        return ++$max;
    }
1173580
public function setMaxWidth($maxWidth)
    {
        $maxWidth = (int) $maxWidth;
        $this->maxWidth = $maxWidth > 0 ? $maxWidth : null;
    }
836929
public function getTtl(): ?int
    {
        $maxAge = $this->getMaxAge();

        return null !== $maxAge ? $maxAge - $this->getAge() : null;
    }
1237659
public function getWidth()
    {
        $width = getenv('COLUMNS');
        if (false !== $width) {
            return (int) trim($width);
        }

        if (null === self::$width) {
            self::initDimensions();
        }

        return self::$width ?: 80;
    }
1011876
def column_max_width(self, column_number):
        
        inner_widths = max_dimensions(self.table_data)[0]
        outer_border = 2 if self.outer_border else 0
        inner_border = 1 if self.inner_column_border else 0
        padding = self.padding_left + self.padding_right
        return column_max_width(inner_widths, column_number, outer_border, inner_border, padding)
1327471
public function getConstrainedDimensions($curW, $curH, $maxW, $maxH)
	{
	    $this->debug->groupCollapsed(__METHOD__);
	    $ratio = $curW / $curH;   // > 1 = wider than tall (landscape) < 1 = portrait
	    $return = array('w' => $curW, 'h' => $curH);
	    if ($return['w'] > $maxW) {
	        $this->debug->log('fitting to maxW');
	        $return = array(
	            'w' => $maxW,
	            'h' => round($maxW / $ratio)
	        );
	    }
	    if ($return['h'] > $maxH) {
	        $this->debug->log('fitting to maxH');
	        $return = array(
	            'w' => round($maxH * $ratio),
	            'h' => $maxH
	        );
	    }
	    // $this->debug->log('return', $return);
	    $this->debug->groupEnd();
	    return $return;
	}
100812
public function setColumnWidthLimits($minWidth = null, $maxWidth = null)
    {
        $this->sheet->setColumnWidthLimits($minWidth, $maxWidth);
    }
860564
public function getLimit()
    {
        if ($this->max > 0) {
            return min($this->max, $this->limit);
        }

        return $this->limit;
    }