public static function stringTrim(string $string, int $length): string
    {
        if ($length<16) return $string;
        if (strlen($string)>$length) {
            $str_head = substr($string, 0, $length-10);
            $str_tail = substr($string, -7, 7);
            return $str_head.'...'.$str_tail;
        }
        return $string;
    }
public static function stringTrim(string $string, int $length): string
    {
        if ($length<16) return $string;
        if (strlen($string)>$length) {
            $str_head = substr($string, 0, $length-10);
            $str_tail = substr($string, -7, 7);
            return $str_head.'...'.$str_tail;
        }
        return $string;
    }
public static function stringTrim ( string $ string , int $ length ) : string { if ( $ length < 16 ) return $ string ; if ( strlen ( $ string ) > $ length ) { $ str_head = substr ( $ string , 0 , $ length - 10 ) ; $ str_tail = substr ( $ string , - 7 , 7 ) ; return $ str_head . '...' . $ str_tail ; } return $ string ; }
Helper function to make a non-unicode string shortter

@param string $string The string to be trimmed
@param int    $length The targeted trimed length

@return string trimmed string
Helper function to make a non - unicode string shortter