private static function truncateStr($str, $limit) { if (strlen($str) > $limit) { return substr($str, 0, $limit) . '...'; } return $str; }