private static function truncateStr($str, $limit)
    {
        if (strlen($str) > $limit) {
            return substr($str, 0, $limit) . '...';
        }
        return $str;
    }
private static function truncateStr($str, $limit)
    {
        if (strlen($str) > $limit) {
            return substr($str, 0, $limit) . '...';
        }
        return $str;
    }
private static function truncateStr ( $ str , $ limit ) { if ( strlen ( $ str ) > $ limit ) { return substr ( $ str , 0 , $ limit ) . '...' ; } return $ str ; }
Utility function that truncates a string to an arbitrary limit.

@param string $str The string to truncate.
@param int $limit The maximum length of the truncated string.
@return string
Utility function that truncates a string to an arbitrary limit .