WC_Gateway_Paypal_Request::limit_length( string $string, integer $limit = 127 )
Limit length of an arg.
Description Description
Parameters Parameters
- $string
-
(Required) Argument to limit.
- $limit
-
(Optional) Limit size in characters.
Default value: 127
Return Return
(string)
Source Source
File: includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php
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;
}