Code Duplication    Length = 17-17 lines in 2 locations

includes/class-wc-tracker.php 1 location

@@ 378-394 (lines=17) @@
375
		}
376
377
		foreach ( $scanned_files as $plugin_name => $files ) {
378
			foreach ( $files as $file ) {
379
				if ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
380
					$theme_file = get_stylesheet_directory() . '/' . $file;
381
				} elseif ( file_exists( get_stylesheet_directory() . '/woocommerce/' . $file ) ) {
382
					$theme_file = get_stylesheet_directory() . '/woocommerce/' . $file;
383
				} elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
384
					$theme_file = get_template_directory() . '/' . $file;
385
				} elseif( file_exists( get_template_directory() . '/woocommerce/' . $file ) ) {
386
					$theme_file = get_template_directory() . '/woocommerce/' . $file;
387
				} else {
388
					$theme_file = false;
389
				}
390
391
				if ( $theme_file !== false ) {
392
					$override_data[] = basename( $theme_file );
393
				}
394
			}
395
		}
396
		return $override_data;
397
	}

includes/api/class-wc-rest-system-status-controller.php 1 location

@@ 608-624 (lines=17) @@
605
		 */
606
		$override_files = array();
607
		$scan_files  = WC_Admin_Status::scan_template_files( WC()->plugin_path() . '/templates/' );
608
		foreach ( $scan_files as $file ) {
609
			if ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
610
				$theme_file = get_stylesheet_directory() . '/' . $file;
611
			} elseif ( file_exists( get_stylesheet_directory() . '/woocommerce/' . $file ) ) {
612
				$theme_file = get_stylesheet_directory() . '/woocommerce/' . $file;
613
			} elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
614
				$theme_file = get_template_directory() . '/' . $file;
615
			} elseif ( file_exists( get_template_directory() . '/woocommerce/' . $file ) ) {
616
				$theme_file = get_template_directory() . '/woocommerce/' . $file;
617
			} else {
618
				$theme_file = false;
619
			}
620
621
			if ( ! empty( $theme_file ) ) {
622
				$override_files[] = str_replace( WP_CONTENT_DIR . '/themes/', '', $theme_file );
623
			}
624
		}
625
626
		$active_theme_info = array(
627
			'name'                    => $active_theme->Name,