protected static function remove_adjacent_characters( $string, callable $strlen, callable $substr, $prev_length = 0, $next_length = 0 ) {
		// Remove previous character.
		if ( $prev_length > 0 ) {
			$string = $substr( $string, $prev_length, $strlen( $string ) );
		}

		// Remove next character.
		if ( $next_length > 0 ) {
			$string = $substr( $string, 0, $strlen( $string ) - $next_length );
		}

		return $string;
	}
protected static function remove_adjacent_characters( $string, callable $strlen, callable $substr, $prev_length = 0, $next_length = 0 ) {
		// Remove previous character.
		if ( $prev_length > 0 ) {
			$string = $substr( $string, $prev_length, $strlen( $string ) );
		}

		// Remove next character.
		if ( $next_length > 0 ) {
			$string = $substr( $string, 0, $strlen( $string ) - $next_length );
		}

		return $string;
	}
protected static function remove_adjacent_characters ( $ string , callable $ strlen , callable $ substr , $ prev_length = 0 , $ next_length = 0 ) { // Remove previous character. if ( $ prev_length > 0 ) { $ string = $ substr ( $ string , $ prev_length , $ strlen ( $ string ) ) ; } // Remove next character. if ( $ next_length > 0 ) { $ string = $ substr ( $ string , 0 , $ strlen ( $ string ) - $ next_length ) ; } return $ string ; }
Remove adjacent characters from given string.

@since 4.2.2
@since 5.1.3 $prev_char and $next_char replaced with $prev_length and $next_length
to support multi-characters replacements.
@since 6.0.0 New required parameters for strlen() and substr() added.

@param  string   $string      The string.
@param  callable $strlen A strlen()-type function.
@param  callable $substr A substr()-type function.
@param  int      $prev_length Optional. Default 0. The number of characters to remove at the beginning.
@param  int      $next_length Optional. Default 0. The number of characters to remove at the end.

@return string              The string without the characters from adjacent nodes.
Remove adjacent characters from given string .