Code Duplication    Length = 13-13 lines in 2 locations

src/database/ADOdbBase.php 1 location

@@ 399-411 (lines=13) @@
396
        $elements  = [];
397
        $i         = $j         = 0;
398
        $in_quotes = false;
399
        while ($i < strlen($arr)) {
400
            // If current char is a double quote and it's not escaped, then
401
            // enter quoted bit
402
            $char = substr($arr, $i, 1);
403
            if ($char == '"' && ($i == 0 || substr($arr, $i - 1, 1) != '\\')) {
404
                $in_quotes = !$in_quotes;
405
            } elseif ($char == ',' && !$in_quotes) {
406
                // Add text so far to the array
407
                $elements[] = substr($arr, $j, $i - $j);
408
                $j          = $i + 1;
409
            }
410
            $i++;
411
        }
412
        // Add final text to the array
413
        $elements[] = substr($arr, $j);
414

src/database/Postgres.php 1 location

@@ 2077-2089 (lines=13) @@
2074
        $aces      = [];
2075
        $i         = $j         = 0;
2076
        $in_quotes = false;
2077
        while ($i < strlen($acl)) {
2078
            // If current char is a double quote and it's not escaped, then
2079
            // enter quoted bit
2080
            $char = substr($acl, $i, 1);
2081
            if ($char == '"' && ($i == 0 || substr($acl, $i - 1, 1) != '\\')) {
2082
                $in_quotes = !$in_quotes;
2083
            } elseif ($char == ',' && !$in_quotes) {
2084
                // Add text so far to the array
2085
                $aces[] = substr($acl, $j, $i - $j);
2086
                $j      = $i + 1;
2087
            }
2088
            $i++;
2089
        }
2090
        // Add final text to the array
2091
        $aces[] = substr($acl, $j);
2092