Code Duplication    Length = 16-16 lines in 4 locations

_inc/lib/jetpack-wpes-query-builder/jetpack-wpes-query-parser.php 4 locations

@@ 227-242 (lines=16) @@
224
				$n = preg_replace( '/"/', '', $n );
225
			}
226
227
			if ( !empty( $args['must_query_fields'] ) && !$filtering ) {
228
				if ( $is_phrase ) {
229
					$this->add_query( array(
230
						'multi_match' => array(
231
							'fields' => $args['must_query_fields'],
232
							'query' => $n,
233
							'type' => 'phrase',
234
					) ) );
235
				} else {
236
					$this->add_query( array(
237
						'multi_match' => array(
238
							'fields' => $args['must_query_fields'],
239
							'query' => $n,
240
					) ) );
241
				}
242
			}
243
244
			if ( !empty( $args['boost_query_fields'] ) ) {
245
				if ( $is_phrase ) {
@@ 244-259 (lines=16) @@
241
				}
242
			}
243
244
			if ( !empty( $args['boost_query_fields'] ) ) {
245
				if ( $is_phrase ) {
246
					$this->add_query( array(
247
						'multi_match' => array(
248
							'fields' => $args['boost_query_fields'],
249
							'query' => $n,
250
							'type' => 'phrase',
251
					) ), 'should' );
252
				} else {
253
					$this->add_query( array(
254
						'multi_match' => array(
255
							'fields' => $args['boost_query_fields'],
256
							'query' => $n,
257
					) ), 'should' );
258
				}
259
			}
260
		}
261
262
		if ( ! empty( $user_ids ) ) {
@@ 317-332 (lines=16) @@
314
				$t = preg_replace( '/"/', '', $t );
315
			}
316
317
			if ( ! empty( $args['must_query_fields'] ) ) {
318
				if ( $is_phrase ) {
319
					$this->add_query( array(
320
						'multi_match' => array(
321
							'fields' => $args['must_query_fields'],
322
							'query' => $t,
323
							'type' => 'phrase',
324
					) ) );
325
				} else {
326
					$this->add_query( array(
327
						'multi_match' => array(
328
							'fields' => $args['must_query_fields'],
329
							'query' => $t,
330
					) ) );
331
				}
332
			}
333
334
			if ( ! empty( $args['boost_query_fields'] ) ) {
335
				if ( $is_phrase ) {
@@ 334-349 (lines=16) @@
331
				}
332
			}
333
334
			if ( ! empty( $args['boost_query_fields'] ) ) {
335
				if ( $is_phrase ) {
336
					$this->add_query( array(
337
						'multi_match' => array(
338
							'fields' => $args['boost_query_fields'],
339
							'query' => $t,
340
							'type' => 'phrase',
341
					) ), 'should' );
342
				} else {
343
					$this->add_query( array(
344
						'multi_match' => array(
345
							'fields' => $args['boost_query_fields'],
346
							'query' => $t,
347
					) ), 'should' );
348
				}
349
			}
350
		}
351
352
		return true;