private function autoWrap($text)
{
$length = 14 * 3;
$j = 0;
$text = str_replace("\r", "", $text);
$new_text = explode("\n", $text);
$data = [];
for ($i = 0; $i < count($new_text); $i++) {
$count = strlen($new_text[$i]);
if ($count > $length) {
$temp_data = $this->utf8StringSplit($new_text[$i]);
$temp_plus = 0;
$temp_split = [];
for ($k = 0; $k < count($temp_data); $k++) {
$temp_plus += strlen($temp_data[$k]);
if ($temp_plus == $length) {
array_push($temp_split, $k);
$temp_plus = 0;
} elseif ($temp_plus > $length) {
array_push($temp_split, $k - 1);
$temp_plus = strlen($temp_data[$k]);
}
}
array_push($temp_split, count($temp_data));
$start = 0;
$temp_string = null;
foreach ($temp_split as $value) {
for ($m = $start; $m <= $value; $m++) {
@($temp_string = $temp_string . $temp_data[$m]);
}
if ($temp_string !== '') {
$data[$j++] = $temp_string;
}
$start = $value + 1;
$temp_string = null;
}
} else {
$data[$j++] = $new_text[$i];
}
}
$data_length = count($data);
if ($data_length > 10) {
$data_length = 10;
}
for ($i = 0; $i < $data_length; $i++) {
@($new_data = $new_data . $data[$i] . "\n");
}
return $new_data;
}