Code Duplication    Length = 6-7 lines in 2 locations

projects/plugins/jetpack/modules/contact-form/grunion-contact-form.php 2 locations

@@ 3417-3423 (lines=7) @@
3414
		}
3415
3416
		switch ( $field_type ) {
3417
			case 'email':
3418
				// Make sure the email address is valid
3419
				if ( ! is_string( $field_value ) || ! is_email( $field_value ) ) {
3420
					/* translators: %s is the name of a form field */
3421
					$this->add_error( sprintf( __( '%s requires a valid email address', 'jetpack' ), $field_label ) );
3422
				}
3423
				break;
3424
			case 'checkbox-multiple':
3425
				// Check that there is at least one option selected
3426
				if ( empty( $field_value ) ) {
@@ 3431-3436 (lines=6) @@
3428
					$this->add_error( sprintf( __( '%s requires at least one selection', 'jetpack' ), $field_label ) );
3429
				}
3430
				break;
3431
			default:
3432
				// Just check for presence of any text
3433
				if ( ! is_string( $field_value ) || ! strlen( trim( $field_value ) ) ) {
3434
					/* translators: %s is the name of a form field */
3435
					$this->add_error( sprintf( __( '%s is required', 'jetpack' ), $field_label ) );
3436
				}
3437
		}
3438
	}
3439