getMaxLineLength() public static method

public static getMaxLineLength ( $string, Webmozart\Console\Api\Formatter\Formatter $formatter = null )
$formatter Webmozart\Console\Api\Formatter\Formatter
示例#1
0
 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);
         }
     }
 }