private function wrapColumn($col, $columnLength, Formatter $formatter)
{
foreach ($this->wrappedRows as $i => $row) {
$cell = $row[$col];
$cellLength = $this->cellLengths[$i][$col];
if ($cellLength > $columnLength) {
$this->wordWraps = true;
if (!$this->wordCuts) {
$minLengthWithoutCut = StringUtil::getMaxWordLength($cell, $formatter);
if ($minLengthWithoutCut > $columnLength) {
$this->wordCuts = true;
}
}
// TODO use format aware wrapper
// true: Words may be cut in two
$wrappedCell = wordwrap($cell, $columnLength, "\n", true);
$this->wrappedRows[$i][$col] = $wrappedCell;
// Refresh cell length
$this->cellLengths[$i][$col] = StringUtil::getMaxLineLength($wrappedCell, $formatter);
}
}
}