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

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