Code Duplication    Length = 26-26 lines in 2 locations

install/cli-install.php 1 location

@@ 607-632 (lines=26) @@
604
605
// setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category
606
$mt = &$moduleTemplates;
607
if (is_dir($templatePath) && is_readable($templatePath)) {
608
    $d = dir($templatePath);
609
    while (false !== ($tplfile = $d->read())) {
610
        if (substr($tplfile, -4) != '.tpl') {
611
            continue;
612
        }
613
        $params = parse_docblock($templatePath, $tplfile);
614
        if (is_array($params) && (count($params) > 0)) {
615
            $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
616
            $mt[] = array
617
            (
618
                $params['name'],
619
                $description,
620
                // Don't think this is gonna be used ... but adding it just in case 'type'
621
                $params['type'],
622
                "$templatePath/{$params['filename']}",
623
                $params['modx_category'],
624
                $params['lock_template'],
625
                array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false,
626
                isset($params['save_sql_id_as']) ? $params['save_sql_id_as'] : null
627
                // Nessecary to fix template-ID for demo-site
628
            );
629
        }
630
    }
631
    $d->close();
632
}
633
634
// setup Template Variable template files
635
$mtv = &$moduleTVs;

install/src/processor/result.php 1 location

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