Code Duplication    Length = 7-7 lines in 2 locations

includes/admin/class-wc-admin-addons.php 2 locations

@@ 27-33 (lines=7) @@
24
	public static function get_sections() {
25
		if ( false === ( $sections = get_transient( 'wc_addons_sections' ) ) ) {
26
			$raw_sections = wp_safe_remote_get( 'https://d3t0oesq8995hv.cloudfront.net/addon-sections.json', array( 'user-agent' => 'WooCommerce Addons Page' ) );
27
			if ( ! is_wp_error( $raw_sections ) ) {
28
				$sections = json_decode( wp_remote_retrieve_body( $raw_sections ) );
29
30
				if ( $sections ) {
31
					set_transient( 'wc_addons_sections', $sections, WEEK_IN_SECONDS );
32
				}
33
			}
34
		}
35
36
		$addon_sections = array();
@@ 82-88 (lines=7) @@
79
			if ( false === ( $section_data = get_transient( 'wc_addons_section_' . $section_id ) ) ) {
80
				$raw_section = wp_safe_remote_get( esc_url_raw( $section->endpoint ), array( 'user-agent' => 'WooCommerce Addons Page' ) );
81
82
				if ( ! is_wp_error( $raw_section ) ) {
83
					$section_data = json_decode( wp_remote_retrieve_body( $raw_section ) );
84
85
					if ( ! empty( $section_data->products ) ) {
86
						set_transient( 'wc_addons_section_' . $section_id, $section_data, WEEK_IN_SECONDS );
87
					}
88
				}
89
			}
90
		}
91