@@ 127-143 (lines=17) @@ | ||
124 | return mb_strwidth($string, $encoding); |
|
125 | } |
|
126 | ||
127 | public static function getMaxWordLength($string, Formatter $formatter = null) |
|
128 | { |
|
129 | if ($formatter) { |
|
130 | $string = $formatter->removeFormat($string); |
|
131 | } |
|
132 | ||
133 | $maxLength = 0; |
|
134 | $words = preg_split('/\s+/', $string); |
|
135 | ||
136 | foreach ($words as $word) { |
|
137 | // No need to pass the formatter because the tags are already |
|
138 | // removed |
|
139 | $maxLength = max($maxLength, self::getLength($word)); |
|
140 | } |
|
141 | ||
142 | return $maxLength; |
|
143 | } |
|
144 | ||
145 | public static function getMaxLineLength($string, Formatter $formatter = null) |
|
146 | { |
|
@@ 145-161 (lines=17) @@ | ||
142 | return $maxLength; |
|
143 | } |
|
144 | ||
145 | public static function getMaxLineLength($string, Formatter $formatter = null) |
|
146 | { |
|
147 | if ($formatter) { |
|
148 | $string = $formatter->removeFormat($string); |
|
149 | } |
|
150 | ||
151 | $maxLength = 0; |
|
152 | $lines = explode("\n", $string); |
|
153 | ||
154 | foreach ($lines as $word) { |
|
155 | // No need to pass the formatter because the tags are already |
|
156 | // removed |
|
157 | $maxLength = max($maxLength, self::getLength($word)); |
|
158 | } |
|
159 | ||
160 | return $maxLength; |
|
161 | } |
|
162 | ||
163 | private function __construct() |
|
164 | { |