Code Duplication    Length = 26-26 lines in 2 locations

install/setup.info.php 1 location

@@ 48-73 (lines=26) @@
45
46
// setup Template Variable template files
47
$mtv = &$moduleTVs;
48
if(is_dir($tvPath) && is_readable($tvPath)) {
49
    $d = dir($tvPath);
50
    while (false !== ($tplfile = $d->read())) {
51
        if(substr($tplfile, -4) != '.tpl') continue;
52
        $params = parse_docblock($tvPath, $tplfile);
53
        if(is_array($params) && (count($params)>0)) {
54
            $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
55
            $mtv[] = array(
56
                $params['name'],
57
                $params['caption'],
58
                $description,
59
                $params['input_type'],
60
                $params['input_options'],
61
                $params['input_default'],
62
                $params['output_widget'],
63
                $params['output_widget_params'],
64
                "$templatePath/{$params['filename']}", /* not currently used */
65
                $params['template_assignments']!="*"?$params['template_assignments']:implode(",",array_map(create_function('$v','return $v[0];'),$mt)), /* comma-separated list of template names */
66
                $params['modx_category'],
67
                $params['lock_tv'],  /* value should be 1 or 0 */
68
                array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
69
            );
70
        }
71
    }
72
    $d->close();
73
}
74
75
// setup chunks template files - array : name, description, type - 0:file or 1:content, file or content
76
$mc = &$moduleChunks;

install/cli-install.php 1 location

@@ 601-626 (lines=26) @@
598
599
// setup Template Variable template files
600
$mtv = &$moduleTVs;
601
if(is_dir($tvPath) && is_readable($tvPath)) {
602
    $d = dir($tvPath);
603
    while (false !== ($tplfile = $d->read())) {
604
        if(substr($tplfile, -4) != '.tpl') continue;
605
        $params = parse_docblock($tvPath, $tplfile);
606
        if(is_array($params) && (count($params)>0)) {
607
            $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
608
            $mtv[] = array(
609
                $params['name'],
610
                $params['caption'],
611
                $description,
612
                $params['input_type'],
613
                $params['input_options'],
614
                $params['input_default'],
615
                $params['output_widget'],
616
                $params['output_widget_params'],
617
                "$templatePath/{$params['filename']}", /* not currently used */
618
                $params['template_assignments']!="*"?$params['template_assignments']:implode(",",array_map(create_function('$v','return $v[0];'),$mt)), /* comma-separated list of template names */
619
                $params['modx_category'],
620
                $params['lock_tv'],  /* value should be 1 or 0 */
621
                array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
622
            );
623
        }
624
    }
625
    $d->close();
626
}
627
628
// setup chunks template files - array : name, description, type - 0:file or 1:content, file or content
629
$mc = &$moduleChunks;