Code Duplication    Length = 3-3 lines in 3 locations

_inc/lib/class.core-rest-api-endpoints.php 3 locations

@@ 2021-2023 (lines=3) @@
2018
2019
			// If it's an associative array, use the keys to check that the value is among those admitted.
2020
			$enum = ( count( array_filter( array_keys( $args['enum'] ), 'is_string' ) ) > 0 ) ? array_keys( $args['enum'] ) : $args['enum'];
2021
			if ( ! in_array( $value, $enum ) ) {
2022
				return new WP_Error( 'invalid_param_value', sprintf( esc_html__( '%s must be one of %s', 'jetpack' ), $param, implode( ', ', $enum ) ) );
2023
			}
2024
		}
2025
		return true;
2026
	}
@@ 2046-2048 (lines=3) @@
2043
2044
		$modules = Jetpack::get_available_modules();
2045
2046
		if ( count( array_intersect( $value, $modules ) ) != count( $value ) ) {
2047
			return new WP_Error( 'invalid_param_value', sprintf( esc_html__( '%s must be a list of valid modules', 'jetpack' ), $param ) );
2048
		}
2049
2050
		return true;
2051
	}
@@ 2200-2202 (lines=3) @@
2197
		$sharer = new Sharing_Service();
2198
		$services = array_keys( $sharer->get_all_services() );
2199
2200
		if ( ! empty( $value ) && ! in_array( $value, $services ) ) {
2201
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s is not a registered custom sharing service.', 'jetpack' ), $param ) );
2202
		}
2203
2204
		return true;
2205
	}