blob: 6fdb4d1200106817fa68b4df29de8e29306d6a85 [file] [log] [blame]
swissChilif0cbdc32023-01-05 17:21:38 -05001<?php
2
3if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly.
5}
6
7use Automattic\WooCommerce\Admin\Notes\Note;
8use Automattic\WooCommerce\Admin\Notes\Notes;
9use Automattic\WooCommerce\Admin\Notes\WC_Admin_Note;
10use Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes;
11
12/**
13 * Util class for handling compatibilities with different versions of WooCommerce core.
14 */
15class WC_Stripe_Woo_Compat_Utils {
16 /**
17 * Return non-deprecated class for instantiating WC-Admin notes.
18 *
19 * @return string
20 */
21 public static function get_note_class() {
22 if ( class_exists( 'Automattic\WooCommerce\Admin\Notes\Note' ) ) {
23 return Note::class;
24 }
25
26 return WC_Admin_Note::class;
27 }
28
29 /**
30 * Return non-deprecated class for instantiating WC-Admin notes.
31 *
32 * @return string
33 */
34 public static function get_notes_class() {
35 if ( class_exists( 'Automattic\WooCommerce\Admin\Notes\Notes' ) ) {
36 return Notes::class;
37 }
38
39 return WC_Admin_Notes::class;
40 }
41}