Code Duplication    Length = 6-7 lines in 2 locations

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

@@ 3350-3356 (lines=7) @@
3347
		}
3348
3349
		switch ( $field_type ) {
3350
			case 'email':
3351
				// Make sure the email address is valid
3352
				if ( ! is_string( $field_value ) || ! is_email( $field_value ) ) {
3353
					/* translators: %s is the name of a form field */
3354
					$this->add_error( sprintf( __( '%s requires a valid email address', 'jetpack' ), $field_label ) );
3355
				}
3356
				break;
3357
			case 'checkbox-multiple':
3358
				// Check that there is at least one option selected
3359
				if ( empty( $field_value ) ) {
@@ 3364-3369 (lines=6) @@
3361
					$this->add_error( sprintf( __( '%s requires at least one selection', 'jetpack' ), $field_label ) );
3362
				}
3363
				break;
3364
			default:
3365
				// Just check for presence of any text
3366
				if ( ! is_string( $field_value ) || ! strlen( trim( $field_value ) ) ) {
3367
					/* translators: %s is the name of a form field */
3368
					$this->add_error( sprintf( __( '%s is required', 'jetpack' ), $field_label ) );
3369
				}
3370
		}
3371
	}
3372