Automattic\WooCommerce\StoreApi\Utilities

JsonWebToken::from_base_64_url()private staticWC 1.0

Decodes a string encoded using url safe base64, supporting auto padding.

Метод класса: JsonWebToken{}

Хуков нет.

Возвращает

Строку.

Использование

$result = JsonWebToken::from_base_64_url( $string );
$string(строка) (обязательный)
the string to be decoded.

Код JsonWebToken::from_base_64_url() WC 7.1.0

private static function from_base_64_url( string $string ) {
	/**
	 * Add padding to base64 strings which require it. Some base64 URL strings
	 * which are decoded will have missing padding which is represented by the
	 * equals sign.
	 */
	if ( strlen( $string ) % 4 !== 0 ) {
		return self::from_base_64_url( $string . '=' );
	}

	return base64_decode( // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode
		str_replace(
			array( '-', '_' ),
			array( '+', '/' ),
			$string
		)
	);
}