Code Duplication    Length = 3-3 lines in 2 locations

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

@@ 1945-1947 (lines=3) @@
1942
	 * @return bool
1943
	 */
1944
	public static function validate_services( $value, $request, $param ) {
1945
		if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) {
1946
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) );
1947
		}
1948
1949
		// Allow to clear everything.
1950
		if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) {
@@ 1982-1984 (lines=3) @@
1979
	 * @return bool
1980
	 */
1981
	public static function validate_custom_service( $value, $request, $param ) {
1982
		if ( ! is_array( $value ) || ! isset( $value['sharing_name'] ) || ! isset( $value['sharing_url'] ) || ! isset( $value['sharing_icon'] ) ) {
1983
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with sharing name, url and icon.', 'jetpack' ), $param ) );
1984
		}
1985
1986
		// Allow to clear everything.
1987
		if ( empty( $value['sharing_name'] ) && empty( $value['sharing_url'] ) && empty( $value['sharing_icon'] ) ) {