Code Duplication    Length = 3-3 lines in 2 locations

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

@@ 1634-1636 (lines=3) @@
1631
	 * @return bool
1632
	 */
1633
	public static function validate_services( $value, $request, $param ) {
1634
		if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) {
1635
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) );
1636
		}
1637
1638
		// Allow to clear everything.
1639
		if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) {
@@ 1674-1676 (lines=3) @@
1671
	 * @return bool
1672
	 */
1673
	public static function validate_custom_service( $value, $request, $param ) {
1674
		if ( ! is_array( $value ) || ! isset( $value['sharing_name'] ) || ! isset( $value['sharing_url'] ) || ! isset( $value['sharing_icon'] ) ) {
1675
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with sharing name, url and icon.', 'jetpack' ), $param ) );
1676
		}
1677
1678
		// Allow to clear everything.
1679
		if ( empty( $value['sharing_name'] ) && empty( $value['sharing_url'] ) && empty( $value['sharing_icon'] ) ) {