Code Duplication    Length = 4-6 lines in 4 locations

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

@@ 370-375 (lines=6) @@
367
		$args = wp_parse_args( $args, $defaults );
368
369
		$phrases = array();
370
		if ( preg_match_all( '/"([^"]+)"/', $this->current_query, $matches ) ) {
371
			foreach ( $matches[1] as $match ) {
372
				$phrases[] = $match;
373
			}
374
			$this->current_query = preg_replace( '/"([^"]+)"/', '', $this->current_query );
375
		}
376
377
		if ( preg_match_all( "/'([^']+)'/", $this->current_query, $matches ) ) {
378
			foreach ( $matches[1] as $match ) {
@@ 377-382 (lines=6) @@
374
			$this->current_query = preg_replace( '/"([^"]+)"/', '', $this->current_query );
375
		}
376
377
		if ( preg_match_all( "/'([^']+)'/", $this->current_query, $matches ) ) {
378
			foreach ( $matches[1] as $match ) {
379
				$phrases[] = $match;
380
			}
381
			$this->current_query = preg_replace( "/'([^']+)'/", '', $this->current_query );
382
		}
383
384
		//look for a final, uncompleted phrase
385
		$phrase_prefix = false;
@@ 386-389 (lines=4) @@
383
384
		//look for a final, uncompleted phrase
385
		$phrase_prefix = false;
386
		if ( preg_match_all( '/"([^"]+)$/', $this->current_query, $matches ) ) {
387
			$phrase_prefix = $matches[1][0];
388
			$this->current_query = preg_replace( '/"([^"]+)$/', '', $this->current_query );
389
		}
390
		if ( preg_match_all( "/'([^']+)$/", $this->current_query, $matches ) ) {
391
			$phrase_prefix = $matches[1][0];
392
			$this->current_query = preg_replace( "/'([^']+)$/", '', $this->current_query );
@@ 390-393 (lines=4) @@
387
			$phrase_prefix = $matches[1][0];
388
			$this->current_query = preg_replace( '/"([^"]+)$/', '', $this->current_query );
389
		}
390
		if ( preg_match_all( "/'([^']+)$/", $this->current_query, $matches ) ) {
391
			$phrase_prefix = $matches[1][0];
392
			$this->current_query = preg_replace( "/'([^']+)$/", '', $this->current_query );
393
		}
394
395
		if ( $phrase_prefix )
396
			$phrases[] = $phrase_prefix;