Returns default column widths based on content types.

@return int[]
977951
protected function getGroupContentColumns(): array
    {
        $contents = $this->getGroupContents();

        $contentCount = count($contents);

        $denominator = floor(static::GRID_SIZE_WITHOUT_LABEL / $contentCount);

        $labelWidth = $denominator > 1 ? 2 : 1;

        // If there is enough space, make labels size 2
        // and spread the rest as evenly as possible over the fields
        // If there is not enough space, try again with labels at size 1
        $labelsTotalWidth = $labelWidth * array_reduce(
            $contents,
            function ($total, $content) {
                return $total + ($content['type'] !== 'field' ? 1 : 0);
            }
        );

        $fieldsCount = array_reduce(
            $contents,
            function ($total, $content) {
                return $total + ($content['type'] === 'field' ? 1 : 0);
            }
        );

        $fieldWidth = (int) floor((static::GRID_SIZE_WITHOUT_LABEL - $labelsTotalWidth) / $fieldsCount);

        $columns = [];

        foreach ($contents as $content) {

            $columns[] = ($content['type'] === 'field') ? $fieldWidth : $labelWidth;
        }

        return $columns;
    }
1305453
def col_widths(self):
        # type: () -> defaultdict
        
        _widths = defaultdict(int)

        all_rows = [self.headers]
        all_rows.extend(self._rows)

        for row in all_rows:
            for idx, col in enumerate(row):
                _col_l = len(col)
                if _col_l > _widths[idx]:
                    _widths[idx] = _col_l

        return _widths
118735
public function findAll()
    {
        $dimensions = [];
        foreach ($this->dimensionsConfiguration as $dimensionIdentifier => $dimensionConfiguration) {
            $dimensions[] = new ContentDimension($dimensionIdentifier, $dimensionConfiguration['default']);
        }
        return $dimensions;
    }
1024708
public function getDimensions(): array
	{
		$dimensions = PHP_OS_FAMILY === 'Windows' ? $this->getDimensionsForWindows() : $this->getDimensionsForUnixLike();

		return $dimensions ?? ['width' => static::DEFAULT_WIDTH, 'height' => static::DEFAULT_HEIGHT];
	}
872751
private function getDefaultSortable()
    {
        if (config('columnsortable.default_first_column', false)) {
            $sortBy = array_first($this->sortable);
            if ( ! is_null($sortBy)) {
                return [$sortBy => config('columnsortable.default_direction', 'asc')];
            }
        }

        return null;
    }
998847
private function getThemeImageSizes()
    {
        $dataProvider = new DefaultDataProvider();
        $dataProvider->setBaseConfig(['source' => 'tl_image_size']);

        $config = $dataProvider->getEmptyConfig();
        $config->setFields(['id', 'name', 'width', 'height']);
        $config->setSorting(['pid', 'name']);

        $collection = $dataProvider->fetchAll($config);
        if (!$collection->count()) {
            return [];
        }

        $sizes = [];
        foreach ($collection as $model) {
            $sizes[$model->getProperty('id')] = sprintf(
                '%s (%sx%s)',
                $model->getProperty('name'),
                $model->getProperty('width'),
                $model->getProperty('height')
            );
        }

        return $sizes;
    }
436107
public function getDimensions(): array
    {
        if ($this->dimensions === null) {
            $attrs = $this->getXmlAttrs();

            $this->dimensions = [
                (float) $attrs->width ?? 0,
                (float) $attrs->height ?? 0,
            ];
        }

        return $this->dimensions;
    }
606365
public function defaults()
    {
        $defaults = $this->config;
        if (!isset($defaults['width'])) {
            $defaults['width'] = $defaults['default_width'];
        }
        if (!isset($defaults['height'])) {
            $defaults['height'] = $defaults['default_height'];
        }
        return $defaults;
    }
860432
public int[] colWidths() {
        int cols = columnCount();
        int[] widths = new int[cols];

        for (int i = 0; i < columnCount(); i++) {
            widths[i] = columns().get(i).columnWidth();
        }
        return widths;
    }
300695
public function getColumns()
    {
        if (empty($this->columns) && !empty($this->data)) {
            //parse columns from data
            $tmp = array_keys(current($this->data));
            return array_combine($tmp, $tmp);
        }

        return $this->columns;
    }
315300
public function getTableColumns() : array
    {
        if (!$this->isTableNameSet()) {
            return [];
        }
        
        $sql = "SHOW COLUMNS FROM `".$this->tableName."`";
        $stmt = $this->db->query($sql);
        $arrResult = $stmt->fetchAll(PDO::FETCH_ASSOC);
        return $arrResult;
    }
543864
protected function getDimensionsFromAnsicon() : ?array
    {
        if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) {
            return [
                'width'  => (int) $matches[1],
                'height' => (int) ($matches[4] ?? $matches[2])
            ];
        }

        return null;
    }
947938
public function columnType($type, $length, $default = null)
    {
        $length = (isset($length) && $length !== '') ? $length : $default;
        $type = strtoupper($type).'('.$length.')';

        return [$type, $length];
    }
86594
public function getColumns()
    {
        $columns = array();
        $columns[$this->_parent_key] = $this->_child_column;
        if ($this->_polymorphic) {
            $columns['type'] = $this->_type_column;
        }

        return $columns;
    }
556987
public function getSchemaDataDefaults()
    {
        $data = parent::getSchemaDataDefaults();
        $data['data']['rows'] = $this->getRows();
        $data['data']['columns'] = $this->getColumns();
        $data['data']['maxlength'] =  $this->getMaxLength();
        return $data;
    }
15820
public function getDefaultValues()
    {
        $values = [];
        foreach ($this->getColumns() as $column) {
            $values[$column->getName()] = $column->getDefaultValue();
        }
        return $values;
    }
418674
public function getLogoDimensions()
    {
        // Initialise:
        
        $data = [];
        
        // Obtain Dimensions:
        
        $widths  = $this->dbObject('BrandLogoWidth');
        $heights = $this->dbObject('BrandLogoHeight');
        
        // Iterate Width Viewports:
        
        foreach ($widths->getViewports() as $viewport) {
            
            if ($value = $widths->getField($viewport)) {
                $data[$viewport]['Width'] = $value;
                $data[$viewport]['Breakpoint'] = $widths->getBreakpoint($viewport);
            }
            
        }
        
        // Iterate Height Viewports:
        
        foreach ($heights->getViewports() as $viewport) {
            
            if ($value = $heights->getField($viewport)) {
                $data[$viewport]['Height'] = $value;
                $data[$viewport]['Breakpoint'] = $heights->getBreakpoint($viewport);
            }
            
        }
        
        // Create Items List:
        
        $items = ArrayList::create();
        
        // Create Data Items:
        
        foreach ($data as $item) {
            $items->push(ArrayData::create($item));
        }
        
        // Answer Items List:
        
        return $items;
    }