Code Duplication    Length = 14-14 lines in 2 locations

src/wp-includes/rest-api.php 2 locations

@@ 491-504 (lines=14) @@
488
 * @param string $replacement The function that should have been called.
489
 * @param string $version     Version.
490
 */
491
function rest_handle_deprecated_function( $function, $replacement, $version ) {
492
	if ( ! WP_DEBUG || headers_sent() ) {
493
		return;
494
	}
495
	if ( ! empty( $replacement ) ) {
496
		/* translators: 1: function name, 2: WordPress version number, 3: new function name */
497
		$string = sprintf( __( '%1$s (since %2$s; use %3$s instead)' ), $function, $version, $replacement );
498
	} else {
499
		/* translators: 1: function name, 2: WordPress version number */
500
		$string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function, $version );
501
	}
502
503
	header( sprintf( 'X-WP-DeprecatedFunction: %s', $string ) );
504
}
505
506
/**
507
 * Handles _deprecated_argument() errors.
@@ 515-528 (lines=14) @@
512
 * @param string $message     A message regarding the change.
513
 * @param string $version     Version.
514
 */
515
function rest_handle_deprecated_argument( $function, $message, $version ) {
516
	if ( ! WP_DEBUG || headers_sent() ) {
517
		return;
518
	}
519
	if ( ! empty( $message ) ) {
520
		/* translators: 1: function name, 2: WordPress version number, 3: error message */
521
		$string = sprintf( __( '%1$s (since %2$s; %3$s)' ), $function, $version, $message );
522
	} else {
523
		/* translators: 1: function name, 2: WordPress version number */
524
		$string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function, $version );
525
	}
526
527
	header( sprintf( 'X-WP-DeprecatedParam: %s', $string ) );
528
}
529
530
/**
531
 * Sends Cross-Origin Resource Sharing headers with API requests.