Code Duplication    Length = 3-3 lines in 2 locations

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

@@ 1833-1835 (lines=3) @@
1830
	 * @return bool
1831
	 */
1832
	public static function validate_services( $value, $request, $param ) {
1833
		if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) {
1834
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) );
1835
		}
1836
1837
		// Allow to clear everything.
1838
		if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) {
@@ 1873-1875 (lines=3) @@
1870
	 * @return bool
1871
	 */
1872
	public static function validate_custom_service( $value, $request, $param ) {
1873
		if ( ! is_array( $value ) || ! isset( $value['sharing_name'] ) || ! isset( $value['sharing_url'] ) || ! isset( $value['sharing_icon'] ) ) {
1874
			return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with sharing name, url and icon.', 'jetpack' ), $param ) );
1875
		}
1876
1877
		// Allow to clear everything.
1878
		if ( empty( $value['sharing_name'] ) && empty( $value['sharing_url'] ) && empty( $value['sharing_icon'] ) ) {