Code Duplication    Length = 3-3 lines in 2 locations

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

@@ 1861-1863 (lines=3) @@
1858
	 * @return bool
1859
	 */
1860
	public static function validate_services( $value, $request, $param ) {
1861
		if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) {
1862
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) );
1863
		}
1864
1865
		// Allow to clear everything.
1866
		if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) {
@@ 1901-1903 (lines=3) @@
1898
	 * @return bool
1899
	 */
1900
	public static function validate_custom_service( $value, $request, $param ) {
1901
		if ( ! is_array( $value ) || ! isset( $value['sharing_name'] ) || ! isset( $value['sharing_url'] ) || ! isset( $value['sharing_icon'] ) ) {
1902
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with sharing name, url and icon.', 'jetpack' ), $param ) );
1903
		}
1904
1905
		// Allow to clear everything.
1906
		if ( empty( $value['sharing_name'] ) && empty( $value['sharing_url'] ) && empty( $value['sharing_icon'] ) ) {