Code Duplication    Length = 3-3 lines in 2 locations

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

@@ 1771-1773 (lines=3) @@
1768
	 * @return bool
1769
	 */
1770
	public static function validate_services( $value, $request, $param ) {
1771
		if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) {
1772
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) );
1773
		}
1774
1775
		// Allow to clear everything.
1776
		if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) {
@@ 1811-1813 (lines=3) @@
1808
	 * @return bool
1809
	 */
1810
	public static function validate_custom_service( $value, $request, $param ) {
1811
		if ( ! is_array( $value ) || ! isset( $value['sharing_name'] ) || ! isset( $value['sharing_url'] ) || ! isset( $value['sharing_icon'] ) ) {
1812
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with sharing name, url and icon.', 'jetpack' ), $param ) );
1813
		}
1814
1815
		// Allow to clear everything.
1816
		if ( empty( $value['sharing_name'] ) && empty( $value['sharing_url'] ) && empty( $value['sharing_icon'] ) ) {