Code Duplication    Length = 8-9 lines in 2 locations

modules/simple-payments/simple-payments.php 1 location

@@ 24-31 (lines=8) @@
21
	// Classic singleton pattern:
22
	private static $instance;
23
	private function __construct() {}
24
	static function getInstance() {
25
		if ( ! self::$instance ) {
26
			self::$instance = new self();
27
			self::$instance->register_init_hooks();
28
			self::$required_plan = ( defined( 'IS_WPCOM' ) && IS_WPCOM ) ? 'value_bundle' : 'jetpack_premium';
29
		}
30
		return self::$instance;
31
	}
32
33
	private function register_scripts_and_styles() {
34
		/**

modules/memberships/class-jetpack-memberships.php 1 location

@@ 77-85 (lines=9) @@
74
	 *
75
	 * @return Jetpack_Memberships
76
	 */
77
	public static function get_instance() {
78
		if ( ! self::$instance ) {
79
			self::$instance = new self();
80
			self::$instance->register_init_hook();
81
			// Yes, `personal-bundle` with a dash, `jetpack_personal` with an underscore. Check the v1.5 endpoint to verify.
82
			self::$required_plan = ( defined( 'IS_WPCOM' ) && IS_WPCOM ) ? 'personal-bundle' : 'jetpack_personal';
83
		}
84
85
		return self::$instance;
86
	}
87
	/**
88
	 * Get the map that defines the shape of CPT post. keys are names of fields and