Code Duplication    Length = 28-28 lines in 2 locations

install/cli-install.php 1 location

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

install/src/processor/result.php 1 location

@@ 53-80 (lines=28) @@
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'] !== "*" ? $params['template_assignments'] : implode(",",
72
                    array_map(create_function('$v', 'return $v[0];'), $mt)),
73
                /* comma-separated list of template names */
74
                $params['modx_category'],
75
                $params['lock_tv'],
76
                /* value should be 1 or 0 */
77
                array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
78
            );
79
        }
80
    }
81
    $d->close();
82
}
83