Code Duplication    Length = 15-19 lines in 2 locations

catalog/includes/functions/general.php 2 locations

@@ 633-647 (lines=15) @@
630
        $tmpstring = trim(preg_replace('/"/', ' ', $pieces[$k]));
631
632
// Check for one possible exception to the rule. That there is a single quoted word.
633
        if (substr($pieces[$k], -1 ) == '"') {
634
// Turn the flag off for future iterations
635
          $flag = 'off';
636
637
          $objects[] = trim(preg_replace('/"/', ' ', $pieces[$k]));
638
639
          for ($j=0; $j<count($post_objects); $j++) {
640
            $objects[] = $post_objects[$j];
641
          }
642
643
          unset($tmpstring);
644
645
// Stop looking for the end of the string and move onto the next word.
646
          continue;
647
        }
648
649
// Otherwise, turn on the flag to indicate no quotes have been found attached to this word in the string.
650
        $flag = 'on';
@@ 675-693 (lines=19) @@
672
// Move on to the next word
673
            $k++;
674
            continue;
675
          } else {
676
/* If the $piece ends in double quotes, strip the double quotes, tack the
677
   $piece onto the tail of the string, push the $tmpstring onto the $haves,
678
   kill the $tmpstring, turn the $flag "off", and return.
679
*/
680
            $tmpstring .= ' ' . trim(preg_replace('/"/', ' ', $pieces[$k]));
681
682
// Push the $tmpstring onto the array of stuff to search for
683
            $objects[] = trim($tmpstring);
684
685
            for ($j=0; $j<count($post_objects); $j++) {
686
              $objects[] = $post_objects[$j];
687
            }
688
689
            unset($tmpstring);
690
691
// Turn off the flag to exit the loop
692
            $flag = 'off';
693
          }
694
        }
695
      }
696
    }