Code Duplication    Length = 25-25 lines in 2 locations

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;

install/cli-install.php 1 location

@@ 573-597 (lines=25) @@
570
571
// setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category
572
$mt = &$moduleTemplates;
573
if(is_dir($templatePath) && is_readable($templatePath)) {
574
    $d = dir($templatePath);
575
    while (false !== ($tplfile = $d->read()))
576
    {
577
        if(substr($tplfile, -4) != '.tpl') continue;
578
        $params = parse_docblock($templatePath, $tplfile);
579
        if(is_array($params) && (count($params)>0))
580
        {
581
            $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
582
            $mt[] = array
583
            (
584
                $params['name'],
585
                $description,
586
                // Don't think this is gonna be used ... but adding it just in case 'type'
587
                $params['type'],
588
                "$templatePath/{$params['filename']}",
589
                $params['modx_category'],
590
                $params['lock_template'],
591
                array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false,
592
                isset($params['save_sql_id_as']) ? $params['save_sql_id_as'] : NULL // Nessecary to fix template-ID for demo-site
593
            );
594
        }
595
    }
596
    $d->close();
597
}
598
599
// setup Template Variable template files
600
$mtv = &$moduleTVs;