Code Duplication    Length = 9-11 lines in 3 locations

includes/admin/class-wc-admin-notices.php 1 location

@@ 235-243 (lines=9) @@
232
		foreach ( $core_templates as $file ) {
233
234
			$theme_file = false;
235
			if ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
236
				$theme_file = get_stylesheet_directory() . '/' . $file;
237
			} elseif ( file_exists( get_stylesheet_directory() . '/woocommerce/' . $file ) ) {
238
				$theme_file = get_stylesheet_directory() . '/woocommerce/' . $file;
239
			} elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
240
				$theme_file = get_template_directory() . '/' . $file;
241
			} elseif( file_exists( get_template_directory() . '/woocommerce/' . $file ) ) {
242
				$theme_file = get_template_directory() . '/woocommerce/' . $file;
243
			}
244
245
			if ( $theme_file !== false ) {
246
				$core_version  = WC_Admin_Status::get_file_version( WC()->plugin_path() . '/templates/' . $file );

includes/admin/views/html-admin-page-status-report.php 1 location

@@ 737-747 (lines=11) @@
734
				$scanned_files = WC_Admin_Status::scan_template_files( $template_path );
735
736
				foreach ( $scanned_files as $file ) {
737
					if ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
738
						$theme_file = get_stylesheet_directory() . '/' . $file;
739
					} elseif ( file_exists( get_stylesheet_directory() . '/woocommerce/' . $file ) ) {
740
						$theme_file = get_stylesheet_directory() . '/woocommerce/' . $file;
741
					} elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
742
						$theme_file = get_template_directory() . '/' . $file;
743
					} elseif( file_exists( get_template_directory() . '/woocommerce/' . $file ) ) {
744
						$theme_file = get_template_directory() . '/woocommerce/' . $file;
745
					} else {
746
						$theme_file = false;
747
					}
748
749
					if ( ! empty( $theme_file ) ) {
750
						$core_version  = WC_Admin_Status::get_file_version( $template_path . $file );

includes/class-wc-tracker.php 1 location

@@ 379-389 (lines=11) @@
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 );