Code Duplication    Length = 7-8 lines in 3 locations

lib/modules/mod_json.php 3 locations

@@ 781-787 (lines=7) @@
778
                            array_pop($stk);
779
                            //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
780
781
                        } elseif (($chrs{$c} == '[') &&
782
                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
783
                            // found a left-bracket, and we are in an array, object, or slice
784
                            array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
785
                            //print("Found start of array at {$c}\n");
786
787
                        } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
788
                            // found a right-bracket, and we're in an array
789
                            array_pop($stk);
790
                            //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
@@ 792-798 (lines=7) @@
789
                            array_pop($stk);
790
                            //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
791
792
                        } elseif (($chrs{$c} == '{') &&
793
                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
794
                            // found a left-brace, and we are in an array, object, or slice
795
                            array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
796
                            //print("Found start of object at {$c}\n");
797
798
                        } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
799
                            // found a right-brace, and we're in an object
800
                            array_pop($stk);
801
                            //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
@@ 803-810 (lines=8) @@
800
                            array_pop($stk);
801
                            //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
802
803
                        } elseif (($substr_chrs_c_2 == '/*') &&
804
                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
805
                            // found a comment start, and we are in an array, object, or slice
806
                            array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
807
                            $c++;
808
                            //print("Found start of comment at {$c}\n");
809
810
                        } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
811
                            // found a comment end, and we're in one now
812
                            array_pop($stk);
813
                            $c++;