Code Duplication    Length = 12-12 lines in 2 locations

modules/custom-post-types/testimonial.php 1 location

@@ 236-247 (lines=12) @@
233
	/*
234
	 * Count published testimonials and flush permalinks when first testimonial is published
235
	 */
236
	function flush_rules_on_first_testimonial() {
237
		$testimonials = get_transient( 'jetpack-testimonial-count-cache' );
238
239
		if ( false === $testimonials ) {
240
			flush_rewrite_rules();
241
			$testimonials = (int) wp_count_posts( self::CUSTOM_POST_TYPE )->publish;
242
243
			if ( ! empty( $testimonials ) ) {
244
				set_transient( 'jetpack-testimonial-count-cache', $testimonials, HOUR_IN_SECONDS * 12 );
245
			}
246
		}
247
	}
248
249
	/*
250
	 * Flush permalinks when CPT supported theme is activated

modules/custom-post-types/portfolios.php 1 location

@@ 168-179 (lines=12) @@
165
	/*
166
	 * Count published projects and flush permalinks when first projects is published
167
	 */
168
	function flush_rules_on_first_project() {
169
		$projects = get_transient( 'jetpack-portfolio-count-cache' );
170
171
		if ( false === $projects ) {
172
			flush_rewrite_rules();
173
			$projects = (int) wp_count_posts( self::CUSTOM_POST_TYPE )->publish;
174
175
			if ( ! empty( $projects ) ) {
176
				set_transient( 'jetpack-portfolio-count-cache', $projects, HOUR_IN_SECONDS * 12 );
177
			}
178
		}
179
	}
180
181
	/*
182
	 * Flush permalinks when CPT supported theme is activated