Code Duplication    Length = 25-26 lines in 2 locations

install/cli-install.php 1 location

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

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;