Code Duplication    Length = 8-8 lines in 3 locations

catalog/includes/functions/general.php 3 locations

@@ 595-602 (lines=8) @@
592
    $flag = '';
593
594
    for ($k=0; $k<count($pieces); $k++) {
595
      while (substr($pieces[$k], 0, 1) == '(') {
596
        $objects[] = '(';
597
        if (strlen($pieces[$k]) > 1) {
598
          $pieces[$k] = substr($pieces[$k], 1);
599
        } else {
600
          $pieces[$k] = '';
601
        }
602
      }
603
604
      $post_objects = array();
605
@@ 606-613 (lines=8) @@
603
604
      $post_objects = array();
605
606
      while (substr($pieces[$k], -1) == ')')  {
607
        $post_objects[] = ')';
608
        if (strlen($pieces[$k]) > 1) {
609
          $pieces[$k] = substr($pieces[$k], 0, -1);
610
        } else {
611
          $pieces[$k] = '';
612
        }
613
      }
614
615
// Check individual words
616
@@ 658-665 (lines=8) @@
655
// Keep reading until the end of the string as long as the $flag is on
656
657
        while ( ($flag == 'on') && ($k < count($pieces)) ) {
658
          while (substr($pieces[$k], -1) == ')') {
659
            $post_objects[] = ')';
660
            if (strlen($pieces[$k]) > 1) {
661
              $pieces[$k] = substr($pieces[$k], 0, -1);
662
            } else {
663
              $pieces[$k] = '';
664
            }
665
          }
666
667
// If the word doesn't end in double quotes, append it to the $tmpstring.
668
          if (substr($pieces[$k], -1) != '"') {