Code Duplication    Length = 6-7 lines in 2 locations

modules/contact-form/grunion-contact-form.php 2 locations

@@ 3287-3293 (lines=7) @@
3284
		}
3285
3286
		switch ( $field_type ) {
3287
			case 'email':
3288
				// Make sure the email address is valid
3289
				if ( ! is_string( $field_value ) || ! is_email( $field_value ) ) {
3290
					/* translators: %s is the name of a form field */
3291
					$this->add_error( sprintf( __( '%s requires a valid email address', 'jetpack' ), $field_label ) );
3292
				}
3293
				break;
3294
			case 'checkbox-multiple':
3295
				// Check that there is at least one option selected
3296
				if ( empty( $field_value ) ) {
@@ 3301-3306 (lines=6) @@
3298
					$this->add_error( sprintf( __( '%s requires at least one selection', 'jetpack' ), $field_label ) );
3299
				}
3300
				break;
3301
			default:
3302
				// Just check for presence of any text
3303
				if ( ! is_string( $field_value ) || ! strlen( trim( $field_value ) ) ) {
3304
					/* translators: %s is the name of a form field */
3305
					$this->add_error( sprintf( __( '%s is required', 'jetpack' ), $field_label ) );
3306
				}
3307
		}
3308
	}
3309