Code Duplication    Length = 19-19 lines in 2 locations

projects/packages/identity-crisis/src/class-identity-crisis.php 1 location

@@ 104-122 (lines=19) @@
101
	 *
102
	 * @param array $processed_items Array of processed items that were synced to WordPress.com.
103
	 */
104
	public function maybe_clear_migrate_option( $processed_items ) {
105
		foreach ( (array) $processed_items as $item ) {
106
107
			// First, is this item a jetpack_sync_callable action? If so, then proceed.
108
			$callable_args = ( is_array( $item ) && isset( $item[0], $item[1] ) && 'jetpack_sync_callable' === $item[0] )
109
				? $item[1]
110
				: null;
111
112
			// Second, if $callable_args is set, check if the callable was home_url or site_url. If so,
113
			// clear the migrate option.
114
			if (
115
				isset( $callable_args, $callable_args[0] )
116
				&& ( 'home_url' === $callable_args[0] || 'site_url' === $callable_args[1] )
117
			) {
118
				Jetpack_Options::delete_option( 'migrate_for_idc' );
119
				break;
120
			}
121
		}
122
	}
123
124
	/**
125
	 * WordPress init.

projects/plugins/jetpack/class.jetpack-idc.php 1 location

@@ 77-95 (lines=19) @@
74
	 *
75
	 * @param $processed_items array Array of processed items that were synced to WordPress.com
76
	 */
77
	function maybe_clear_migrate_option( $processed_items ) {
78
		foreach ( (array) $processed_items as $item ) {
79
80
			// First, is this item a jetpack_sync_callable action? If so, then proceed.
81
			$callable_args = ( is_array( $item ) && isset( $item[0], $item[1] ) && 'jetpack_sync_callable' === $item[0] )
82
				? $item[1]
83
				: null;
84
85
			// Second, if $callable_args is set, check if the callable was home_url or site_url. If so,
86
			// clear the migrate option.
87
			if (
88
				isset( $callable_args, $callable_args[0] )
89
				&& ( 'home_url' === $callable_args[0] || 'site_url' === $callable_args[1] )
90
			) {
91
				Jetpack_Options::delete_option( 'migrate_for_idc' );
92
				break;
93
			}
94
		}
95
	}
96
97
	function wordpress_init() {
98
		if ( ! current_user_can( 'jetpack_disconnect' ) && is_admin() ) {