Code Duplication    Length = 20-20 lines in 2 locations

install/cli-install.php 1 location

@@ 614-633 (lines=20) @@
611
612
// setup chunks template files - array : name, description, type - 0:file or 1:content, file or content
613
$mc = &$moduleChunks;
614
if(is_dir($chunkPath) && is_readable($chunkPath)) {
615
    $d = dir($chunkPath);
616
    while (false !== ($tplfile = $d->read())) {
617
        if(substr($tplfile, -4) != '.tpl') {
618
            continue;
619
        }
620
        $params = parse_docblock($chunkPath, $tplfile);
621
        if(is_array($params) && count($params) > 0) {
622
            $mc[] = array(
623
                $params['name'],
624
                $params['description'],
625
                "$chunkPath/{$params['filename']}",
626
                $params['modx_category'],
627
                array_key_exists('overwrite', $params) ? $params['overwrite'] : 'true',
628
                array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
629
            );
630
        }
631
    }
632
    $d->close();
633
}
634
635
// setup snippets template files - array : name, description, type - 0:file or 1:content, file or content,properties
636
$ms = &$moduleSnippets;

install/setup.info.php 1 location

@@ 77-96 (lines=20) @@
74
75
// setup chunks template files - array : name, description, type - 0:file or 1:content, file or content
76
$mc = &$moduleChunks;
77
if(is_dir($chunkPath) && is_readable($chunkPath)) {
78
    $d = dir($chunkPath);
79
    while (false !== ($tplfile = $d->read())) {
80
        if(substr($tplfile, -4) != '.tpl') {
81
            continue;
82
        }
83
        $params = parse_docblock($chunkPath, $tplfile);
84
        if(is_array($params) && count($params) > 0) {
85
            $mc[] = array(
86
                $params['name'],
87
                $params['description'],
88
                "$chunkPath/{$params['filename']}",
89
                $params['modx_category'],
90
                array_key_exists('overwrite', $params) ? $params['overwrite'] : 'true',
91
                array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
92
            );
93
        }
94
    }
95
    $d->close();
96
}
97
98
// setup snippets template files - array : name, description, type - 0:file or 1:content, file or content,properties
99
$ms = &$moduleSnippets;