Code Duplication    Length = 3-3 lines in 3 locations

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

@@ 2014-2016 (lines=3) @@
2011
2012
			// If it's an associative array, use the keys to check that the value is among those admitted.
2013
			$enum = ( count( array_filter( array_keys( $args['enum'] ), 'is_string' ) ) > 0 ) ? array_keys( $args['enum'] ) : $args['enum'];
2014
			if ( ! in_array( $value, $enum ) ) {
2015
				return new WP_Error( 'invalid_param_value', sprintf( esc_html__( '%s must be one of %s', 'jetpack' ), $param, implode( ', ', $enum ) ) );
2016
			}
2017
		}
2018
		return true;
2019
	}
@@ 2039-2041 (lines=3) @@
2036
2037
		$modules = Jetpack::get_available_modules();
2038
2039
		if ( count( array_intersect( $value, $modules ) ) != count( $value ) ) {
2040
			return new WP_Error( 'invalid_param_value', sprintf( esc_html__( '%s must be a list of valid modules', 'jetpack' ), $param ) );
2041
		}
2042
2043
		return true;
2044
	}
@@ 2193-2195 (lines=3) @@
2190
		$sharer = new Sharing_Service();
2191
		$services = array_keys( $sharer->get_all_services() );
2192
2193
		if ( ! empty( $value ) && ! in_array( $value, $services ) ) {
2194
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s is not a registered custom sharing service.', 'jetpack' ), $param ) );
2195
		}
2196
2197
		return true;
2198
	}