Code Duplication    Length = 25-25 lines in 2 locations

install/cli-install.php 1 location

@@ 557-581 (lines=25) @@
554
555
// setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category
556
$mt = &$moduleTemplates;
557
if(is_dir($templatePath) && is_readable($templatePath)) {
558
    $d = dir($templatePath);
559
    while (false !== ($tplfile = $d->read()))
560
    {
561
        if(substr($tplfile, -4) != '.tpl') continue;
562
        $params = parse_docblock($templatePath, $tplfile);
563
        if(is_array($params) && (count($params)>0))
564
        {
565
            $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
566
            $mt[] = array
567
            (
568
                $params['name'],
569
                $description,
570
                // Don't think this is gonna be used ... but adding it just in case 'type'
571
                $params['type'],
572
                "$templatePath/{$params['filename']}",
573
                $params['modx_category'],
574
                $params['lock_template'],
575
                array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false,
576
                isset($params['save_sql_id_as']) ? $params['save_sql_id_as'] : NULL // Nessecary to fix template-ID for demo-site
577
            );
578
        }
579
    }
580
    $d->close();
581
}
582
583
// setup Template Variable template files
584
$mtv = &$moduleTVs;

install/setup.info.php 1 location

@@ 20-44 (lines=25) @@
17
18
// setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category
19
$mt = &$moduleTemplates;
20
if(is_dir($templatePath) && is_readable($templatePath)) {
21
    $d = dir($templatePath);
22
    while (false !== ($tplfile = $d->read()))
23
    {
24
        if(substr($tplfile, -4) != '.tpl') continue;
25
        $params = parse_docblock($templatePath, $tplfile);
26
        if(is_array($params) && (count($params)>0))
27
        {
28
            $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
29
            $mt[] = array
30
            (
31
                $params['name'],
32
                $description,
33
                // Don't think this is gonna be used ... but adding it just in case 'type'
34
                $params['type'],
35
                "$templatePath/{$params['filename']}",
36
                $params['modx_category'],
37
                $params['lock_template'],
38
                array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false,
39
                isset($params['save_sql_id_as']) ? $params['save_sql_id_as'] : NULL // Nessecary to fix template-ID for demo-site
40
            );
41
        }
42
    }
43
    $d->close();
44
}
45
46
// setup Template Variable template files
47
$mtv = &$moduleTVs;