Code Duplication    Length = 33-33 lines in 2 locations

install/cli-install.php 1 location

@@ 636-668 (lines=33) @@
633
634
// setup Template Variable template files
635
$mtv = &$moduleTVs;
636
if (is_dir($tvPath) && is_readable($tvPath)) {
637
    $d = dir($tvPath);
638
    while (false !== ($tplfile = $d->read())) {
639
        if (substr($tplfile, -4) != '.tpl') {
640
            continue;
641
        }
642
        $params = parse_docblock($tvPath, $tplfile);
643
        if (is_array($params) && (count($params) > 0)) {
644
            $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
645
            $mtv[] = array(
646
                $params['name'],
647
                $params['caption'],
648
                $description,
649
                $params['input_type'],
650
                $params['input_options'],
651
                $params['input_default'],
652
                $params['output_widget'],
653
                $params['output_widget_params'],
654
                "$templatePath/{$params['filename']}",
655
                /* not currently used */
656
                $params['template_assignments'] != "*" ?
657
                    $params['template_assignments'] :
658
                    implode(',', array_map(function($value){return isset($value[0]) && is_scalar($value[0]);},$mt)),
659
                /* comma-separated list of template names */
660
                $params['modx_category'],
661
                $params['lock_tv'],
662
                /* value should be 1 or 0 */
663
                array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
664
            );
665
        }
666
    }
667
    $d->close();
668
}
669
670
// setup chunks template files - array : name, description, type - 0:file or 1:content, file or content
671
$mc = &$moduleChunks;

install/src/processor/result.php 1 location

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