protected function calculateRowsSize()
    {
        $this->_columnWidths = $columns = [];
        $totalWidth = 0;
        $screenWidth = $this->getScreenWidth() - self::CONSOLE_SCROLLBAR_OFFSET;

        for ($i = 0, $count = count($this->_headers); $i < $count; $i++) {
            $columns[] = ArrayHelper::getColumn($this->_rows, $i);
            $columns[$i][] = $this->_headers[$i];
        }

        foreach ($columns as $column) {
            $columnWidth = max(array_map(function ($val) {
                if (is_array($val)) {
                    $encodings = array_fill(0, count($val), $this->app->encoding);
                    return max(array_map('mb_strwidth', $val, $encodings)) + mb_strwidth($this->_listPrefix, $this->app->encoding);
                }

                return mb_strwidth($val, $this->app->encoding);
            }, $column)) + 2;
            $this->_columnWidths[] = $columnWidth;
            $totalWidth += $columnWidth;
        }

        $relativeWidth = $screenWidth / $totalWidth;

        if ($totalWidth > $screenWidth) {
            foreach ($this->_columnWidths as $j => $width) {
                $this->_columnWidths[$j] = (int) ($width * $relativeWidth);
                if ($j === count($this->_columnWidths)) {
                    $this->_columnWidths = $totalWidth;
                }
                $totalWidth -= $this->_columnWidths[$j];
            }
        }
    }
protected function calculateRowsSize()
    {
        $this->_columnWidths = $columns = [];
        $totalWidth = 0;
        $screenWidth = $this->getScreenWidth() - self::CONSOLE_SCROLLBAR_OFFSET;

        for ($i = 0, $count = count($this->_headers); $i < $count; $i++) {
            $columns[] = ArrayHelper::getColumn($this->_rows, $i);
            $columns[$i][] = $this->_headers[$i];
        }

        foreach ($columns as $column) {
            $columnWidth = max(array_map(function ($val) {
                if (is_array($val)) {
                    $encodings = array_fill(0, count($val), $this->app->encoding);
                    return max(array_map('mb_strwidth', $val, $encodings)) + mb_strwidth($this->_listPrefix, $this->app->encoding);
                }

                return mb_strwidth($val, $this->app->encoding);
            }, $column)) + 2;
            $this->_columnWidths[] = $columnWidth;
            $totalWidth += $columnWidth;
        }

        $relativeWidth = $screenWidth / $totalWidth;

        if ($totalWidth > $screenWidth) {
            foreach ($this->_columnWidths as $j => $width) {
                $this->_columnWidths[$j] = (int) ($width * $relativeWidth);
                if ($j === count($this->_columnWidths)) {
                    $this->_columnWidths = $totalWidth;
                }
                $totalWidth -= $this->_columnWidths[$j];
            }
        }
    }
protected function calculateRowsSize ( ) { $ this -> _columnWidths = $ columns = [ ] ; $ totalWidth = 0 ; $ screenWidth = $ this -> getScreenWidth ( ) - self :: CONSOLE_SCROLLBAR_OFFSET ; for ( $ i = 0 , $ count = count ( $ this -> _headers ) ; $ i < $ count ; $ i ++ ) { $ columns [ ] = ArrayHelper :: getColumn ( $ this -> _rows , $ i ) ; $ columns [ $ i ] [ ] = $ this -> _headers [ $ i ] ; } foreach ( $ columns as $ column ) { $ columnWidth = max ( array_map ( function ( $ val ) { if ( is_array ( $ val ) ) { $ encodings = array_fill ( 0 , count ( $ val ) , $ this -> app -> encoding ) ; return max ( array_map ( 'mb_strwidth' , $ val , $ encodings ) ) + mb_strwidth ( $ this -> _listPrefix , $ this -> app -> encoding ) ; } return mb_strwidth ( $ val , $ this -> app -> encoding ) ; } , $ column ) ) + 2 ; $ this -> _columnWidths [ ] = $ columnWidth ; $ totalWidth += $ columnWidth ; } $ relativeWidth = $ screenWidth / $ totalWidth ; if ( $ totalWidth > $ screenWidth ) { foreach ( $ this -> _columnWidths as $ j => $ width ) { $ this -> _columnWidths [ $ j ] = ( int ) ( $ width * $ relativeWidth ) ; if ( $ j === count ( $ this -> _columnWidths ) ) { $ this -> _columnWidths = $ totalWidth ; } $ totalWidth -= $ this -> _columnWidths [ $ j ] ; } } }
Calculate the size of rows to draw anchor of columns in console.

@see \Yiisoft\Yii\Console\Widgets\Table::render()
Calculate the size of rows to draw anchor of columns in console .