Automattic\WooCommerce\StoreApi\Utilities

JsonWebToken::to_base_64_url()private staticWC 1.0

Encodes a string to url safe base64.

Method of the class: JsonWebToken{}

No Hooks.

Return

String.

Usage

$result = JsonWebToken::to_base_64_url( $string );
$string(string) (required)
The string to be encoded.

JsonWebToken::to_base_64_url() code WC 8.6.1

private static function to_base_64_url( string $string ) {
	return str_replace(
		array( '+', '/', '=' ),
		array( '-', '_', '' ),
		base64_encode( $string ) // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
	);
}