Code Duplication    Length = 5-6 lines in 2 locations

manager/includes/functions/processors.php 1 location

@@ 70-74 (lines=5) @@
67
68
        // Handle incremental ID
69
        switch ($modx->config['docid_incrmnt_method']) {
70
            case '1':
71
                $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id";
72
                $rs = $modx->getDatabase()->select('MIN(T0.id)+1', $from, "T1.id IS NULL");
73
                $content['id'] = $modx->getDatabase()->getValue($rs);
74
                break;
75
            case '2':
76
                $rs = $modx->getDatabase()->select('MAX(id)+1', $tblsc);
77
                $content['id'] = $modx->getDatabase()->getValue($rs);

manager/processors/save_content.processor.php 1 location

@@ 282-287 (lines=6) @@
279
            // invoke OnBeforeDocFormSave event
280
            switch($modx->config['docid_incrmnt_method'])
281
            {
282
            case '1':
283
                $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id";
284
                $where = "T1.id IS NULL";
285
                $rs = $modx->getDatabase()->select('MIN(T0.id)+1', $from, "T1.id IS NULL");
286
                $id = $modx->getDatabase()->getValue($rs);
287
                break;
288
            case '2':
289
                $rs = $modx->getDatabase()->select('MAX(id)+1', $tbl_site_content);
290
                $id = $modx->getDatabase()->getValue($rs);