Code Duplication    Length = 27-27 lines in 2 locations

functions.global.php 2 locations

@@ 34-60 (lines=27) @@
31
 * @param string $replacement Optional. The function that should have been called. Default null.
32
 * @param string $version     The version of Jetpack that deprecated the function.
33
 */
34
function jetpack_deprecated_function( $function, $replacement, $version ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
35
	// Bail early for non-Jetpack deprecations.
36
	if ( 0 !== strpos( $version, 'jetpack-' ) ) {
37
		return;
38
	}
39
40
	// Look for when a function will be removed based on when it was deprecated.
41
	$removed_version = jetpack_get_future_removed_version( $version );
42
43
	// If we could find a version, let's log a message about when removal will happen.
44
	if (
45
		! empty( $removed_version )
46
		&& ( defined( 'WP_DEBUG' ) && WP_DEBUG )
47
		/** This filter is documented in core/src/wp-includes/functions.php */
48
		&& apply_filters( 'deprecated_function_trigger_error', true )
49
	) {
50
		error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
51
			sprintf(
52
				/* Translators: 1. Function name. 2. Jetpack version number. */
53
				__( 'The %1$s function will be removed from the Jetpack plugin in version %2$s.', 'jetpack' ),
54
				$function,
55
				$removed_version
56
			)
57
		);
58
59
	}
60
}
61
add_action( 'deprecated_function_run', 'jetpack_deprecated_function', 10, 3 );
62
63
/**
@@ 74-100 (lines=27) @@
71
 * @param string $version     The version of WordPress that deprecated the file.
72
 * @param string $message     A message regarding the change.
73
 */
74
function jetpack_deprecated_file( $file, $replacement, $version, $message ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
75
	// Bail early for non-Jetpack deprecations.
76
	if ( 0 !== strpos( $version, 'jetpack-' ) ) {
77
		return;
78
	}
79
80
	// Look for when a file will be removed based on when it was deprecated.
81
	$removed_version = jetpack_get_future_removed_version( $version );
82
83
	// If we could find a version, let's log a message about when removal will happen.
84
	if (
85
		! empty( $removed_version )
86
		&& ( defined( 'WP_DEBUG' ) && WP_DEBUG )
87
		/** This filter is documented in core/src/wp-includes/functions.php */
88
		&& apply_filters( 'deprecated_file_trigger_error', true )
89
	) {
90
		error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
91
			sprintf(
92
				/* Translators: 1. File name. 2. Jetpack version number. */
93
				__( 'The %1$s file will be removed from the Jetpack plugin in version %2$s.', 'jetpack' ),
94
				$file,
95
				$removed_version
96
			)
97
		);
98
99
	}
100
}
101
add_action( 'deprecated_file_included', 'jetpack_deprecated_file', 10, 4 );
102
103
/**