Code Duplication    Length = 25-25 lines in 2 locations

includes/forms/class-give-forms-query.php 1 location

@@ 116-140 (lines=25) @@
113
		if ( $query->have_posts() ) {
114
			$this->update_meta_cache( wp_list_pluck( $query->posts, 'ID' ) );
115
116
			if ( ! in_array( $this->args['output'], $custom_output ) ) {
117
				$results = $query->posts;
118
119
			} else {
120
				$previous_post = $post;
121
122
				while ( $query->have_posts() ) {
123
					$query->the_post();
124
125
					$form_id = get_post()->ID;
126
					$form    = new Give_Donate_Form( $form_id );
127
128
					$this->forms[] = apply_filters( 'give_form', $form, $form_id, $this );
129
				}
130
131
				wp_reset_postdata();
132
133
				// Prevent nest loop from producing unexpected results.
134
				if ( $previous_post instanceof WP_Post ) {
135
					$post = $previous_post;
136
					setup_postdata( $post );
137
				}
138
139
				$results = $this->forms;
140
			}
141
		}
142
143
		Give_Cache::set_db_query( $cache_key, $results );

includes/payments/class-payments-query.php 1 location

@@ 254-278 (lines=25) @@
251
				self::update_meta_cache( wp_list_pluck( $query->posts, 'ID' ) );
252
			}
253
254
			if ( ! in_array( $this->args['output'], $custom_output ) ) {
255
				$results = $query->posts;
256
257
			} else{
258
				$previous_post = $post;
259
260
				while ( $query->have_posts() ) {
261
					$query->the_post();
262
263
					$payment_id = get_post()->ID;
264
					$payment    = new Give_Payment( $payment_id );
265
266
					$this->payments[] = apply_filters( 'give_payment', $payment, $payment_id, $this );
267
				}
268
269
				wp_reset_postdata();
270
271
				// Prevent nest loop from producing unexpected results.
272
				if ( $previous_post instanceof WP_Post ) {
273
					$post = $previous_post;
274
					setup_postdata( $post );
275
				}
276
277
				$results = $this->payments;
278
			}
279
		}
280
281
		Give_Cache::set_db_query( $cache_key, $results );