Code Duplication    Length = 7-7 lines in 2 locations

includes/class-wc-https.php 2 locations

@@ 88-94 (lines=7) @@
85
	public static function force_https_template_redirect() {
86
		if ( ! is_ssl() && ( is_checkout() || is_account_page() || apply_filters( 'woocommerce_force_ssl_checkout', false ) ) ) {
87
88
			if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
89
				wp_safe_redirect( preg_replace( '|^http://|', 'https://', $_SERVER['REQUEST_URI'] ) );
90
				exit;
91
			} else {
92
				wp_safe_redirect( 'https://' . ( ! empty( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'] ) . $_SERVER['REQUEST_URI'] );
93
				exit;
94
			}
95
		}
96
	}
97
@@ 108-114 (lines=7) @@
105
106
		if ( ! wc_site_is_https() && is_ssl() && $_SERVER['REQUEST_URI'] && ! is_checkout() && ! is_ajax() && ! is_account_page() && apply_filters( 'woocommerce_unforce_ssl_checkout', true ) ) {
107
108
			if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
109
				wp_safe_redirect( preg_replace( '|^https://|', 'http://', $_SERVER['REQUEST_URI'] ) );
110
				exit;
111
			} else {
112
				wp_safe_redirect( 'http://' . ( ! empty( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'] ) . $_SERVER['REQUEST_URI'] );
113
				exit;
114
			}
115
		}
116
	}
117