Code Duplication    Length = 15-19 lines in 2 locations

catalog/includes/functions/general.php 2 locations

@@ 666-680 (lines=15) @@
663
        $tmpstring = trim(preg_replace('/"/', ' ', $pieces[$k]));
664
665
// Check for one possible exception to the rule. That there is a single quoted word.
666
        if (substr($pieces[$k], -1 ) == '"') {
667
// Turn the flag off for future iterations
668
          $flag = 'off';
669
670
          $objects[] = trim(preg_replace('/"/', ' ', $pieces[$k]));
671
672
          for ($j=0; $j<count($post_objects); $j++) {
673
            $objects[] = $post_objects[$j];
674
          }
675
676
          unset($tmpstring);
677
678
// Stop looking for the end of the string and move onto the next word.
679
          continue;
680
        }
681
682
// Otherwise, turn on the flag to indicate no quotes have been found attached to this word in the string.
683
        $flag = 'on';
@@ 708-726 (lines=19) @@
705
// Move on to the next word
706
            $k++;
707
            continue;
708
          } else {
709
/* If the $piece ends in double quotes, strip the double quotes, tack the
710
   $piece onto the tail of the string, push the $tmpstring onto the $haves,
711
   kill the $tmpstring, turn the $flag "off", and return.
712
*/
713
            $tmpstring .= ' ' . trim(preg_replace('/"/', ' ', $pieces[$k]));
714
715
// Push the $tmpstring onto the array of stuff to search for
716
            $objects[] = trim($tmpstring);
717
718
            for ($j=0; $j<count($post_objects); $j++) {
719
              $objects[] = $post_objects[$j];
720
            }
721
722
            unset($tmpstring);
723
724
// Turn off the flag to exit the loop
725
            $flag = 'off';
726
          }
727
        }
728
      }
729
    }