Code Duplication    Length = 4-6 lines in 4 locations

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

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