Code Duplication    Length = 3-13 lines in 2 locations

projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-user-endpoint.php 1 location

@@ 209-211 (lines=3) @@
206
			}
207
208
			$editable_roles = array_keys( get_editable_roles() );
209
			if ( ! in_array( $user['role'], $editable_roles ) ) {
210
				return new WP_Error( 'invalid_input', sprintf( __( '%s is not a valid role.', 'jetpack' ), $editable_roles ), 400 );
211
			}
212
		}
213
214
		$result = wp_update_user( $user );

projects/packages/connection/src/class-manager.php 1 location

@@ 1982-1994 (lines=13) @@
1979
			'src.wordpress-develop.test',   // VVV pattern.
1980
			'build.wordpress-develop.test', // VVV pattern.
1981
		);
1982
		if ( in_array( $domain, $forbidden_domains, true ) ) {
1983
			return new \WP_Error(
1984
				'fail_domain_forbidden',
1985
				sprintf(
1986
					/* translators: %1$s is a domain name. */
1987
					__(
1988
						'Domain `%1$s` just failed is_usable_domain check as it is in the forbidden array.',
1989
						'jetpack'
1990
					),
1991
					$domain
1992
				)
1993
			);
1994
		}
1995
1996
		// No .test or .local domains.
1997
		if ( preg_match( '#\.(test|local)$#i', $domain ) ) {