WordPress at Your Fingertips
function is not described

WC_Gateway_Paypal_Request::limit_length() protected WC 1.0

Limit length of an arg.

{} It's a method of the class: WC_Gateway_Paypal_Request{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->limit_length( $string, $limit );
$string(string) (required)
Argument to limit.
$limit(int)
Limit size in characters.
Default: 127

Code of WC_Gateway_Paypal_Request::limit_length() WC 5.6.0

protected function limit_length( $string, $limit = 127 ) {
	$str_limit = $limit - 3;
	if ( function_exists( 'mb_strimwidth' ) ) {
		if ( mb_strlen( $string ) > $limit ) {
			$string = mb_strimwidth( $string, 0, $str_limit ) . '...';
		}
	} else {
		if ( strlen( $string ) > $limit ) {
			$string = substr( $string, 0, $str_limit ) . '...';
		}
	}
	return $string;
}