Code Duplication    Length = 14-14 lines in 3 locations

extensions/blocks/calendly/calendly.php 1 location

@@ 57-70 (lines=14) @@
54
 * Set the availability of the block as the editor
55
 * is loaded
56
 */
57
function set_availability() {
58
	if ( is_available() ) {
59
		\Jetpack_Gutenberg::set_extension_available( BLOCK_NAME );
60
	} else {
61
		\Jetpack_Gutenberg::set_extension_unavailable(
62
			BLOCK_NAME,
63
			'missing_plan',
64
			array(
65
				'required_feature' => 'calendly',
66
				'required_plan'    => 'value_bundle',
67
			)
68
		);
69
	}
70
}
71
add_action( 'init', 'Jetpack\Calendly_Block\set_availability' );
72
73
/**

extensions/blocks/google-calendar/google-calendar.php 1 location

@@ 58-71 (lines=14) @@
55
 * Set the availability of the block as the editor
56
 * is loaded
57
 */
58
function set_availability() {
59
	if ( is_available() ) {
60
		\Jetpack_Gutenberg::set_extension_available( BLOCK_NAME );
61
	} else {
62
		\Jetpack_Gutenberg::set_extension_unavailable(
63
			BLOCK_NAME,
64
			'missing_plan',
65
			array(
66
				'required_feature' => 'google_calendar',
67
				'required_plan'    => 'value_bundle',
68
			)
69
		);
70
	}
71
}
72
add_action( 'init', 'Jetpack\Google_Calendar_Block\set_availability' );
73
74
/**

extensions/blocks/opentable/opentable.php 1 location

@@ 57-70 (lines=14) @@
54
 * Set the availability of the block as the editor
55
 * is loaded.
56
 */
57
function set_availability() {
58
	if ( is_available() ) {
59
		\Jetpack_Gutenberg::set_extension_available( BLOCK_NAME );
60
	} else {
61
		\Jetpack_Gutenberg::set_extension_unavailable(
62
			BLOCK_NAME,
63
			'missing_plan',
64
			array(
65
				'required_feature' => 'opentable',
66
				'required_plan'    => 'premium-plan',
67
			)
68
		);
69
	}
70
}
71
add_action( 'jetpack_register_gutenberg_extensions', 'Jetpack\OpenTable_Block\set_availability' );
72
73
/**