/** * @param $lengths * * @return mixed */ protected function increaseLengthToo100Percent($lengths) { if (!Configuration::isPlainTable100()) { return $lengths; } $fullWidth = Configuration::getPlainTextWith(); // Calc $rowCount = sizeof($lengths) + 1; $yCount = $rowCount - 2; $currentWidth = array_sum($lengths); if ($this->tableSettings[$this->renderMode]['outerLeft']) { $yCount++; } if ($this->tableSettings[$this->renderMode]['outerRight']) { $yCount++; } $currentWidth += strlen($this->tableSettings[$this->renderMode]['yChar']) * $yCount; $currentWidth += $this->tableSettings[$this->renderMode]['xSpace'] * $rowCount; if ($fullWidth < $currentWidth) { return $lengths; } $moreChars = $fullWidth - $currentWidth; while ($moreChars > 0) { foreach ($lengths as $key => $value) { if ($moreChars <= 0) { break; } $lengths[$key]++; $moreChars--; } } return $lengths; }