Code Duplication    Length = 8-8 lines in 3 locations

catalog/includes/functions/general.php 3 locations

@@ 628-635 (lines=8) @@
625
    $flag = '';
626
627
    for ($k=0; $k<count($pieces); $k++) {
628
      while (substr($pieces[$k], 0, 1) == '(') {
629
        $objects[] = '(';
630
        if (strlen($pieces[$k]) > 1) {
631
          $pieces[$k] = substr($pieces[$k], 1);
632
        } else {
633
          $pieces[$k] = '';
634
        }
635
      }
636
637
      $post_objects = array();
638
@@ 639-646 (lines=8) @@
636
637
      $post_objects = array();
638
639
      while (substr($pieces[$k], -1) == ')')  {
640
        $post_objects[] = ')';
641
        if (strlen($pieces[$k]) > 1) {
642
          $pieces[$k] = substr($pieces[$k], 0, -1);
643
        } else {
644
          $pieces[$k] = '';
645
        }
646
      }
647
648
// Check individual words
649
@@ 691-698 (lines=8) @@
688
// Keep reading until the end of the string as long as the $flag is on
689
690
        while ( ($flag == 'on') && ($k < count($pieces)) ) {
691
          while (substr($pieces[$k], -1) == ')') {
692
            $post_objects[] = ')';
693
            if (strlen($pieces[$k]) > 1) {
694
              $pieces[$k] = substr($pieces[$k], 0, -1);
695
            } else {
696
              $pieces[$k] = '';
697
            }
698
          }
699
700
// If the word doesn't end in double quotes, append it to the $tmpstring.
701
          if (substr($pieces[$k], -1) != '"') {