Code Duplication    Length = 17-17 lines in 2 locations

main/install/install.lib.php 1 location

@@ 440-456 (lines=17) @@
437
 * @param   string  $directory  Full path to a directory
438
 * @return  array   A list of files and dirs in the directory
439
 */
440
function my_directory_to_array($directory)
441
{
442
    $array_items = array();
443
    if ($handle = opendir($directory)) {
444
        while (false !== ($file = readdir($handle))) {
445
            if ($file != "." && $file != "..") {
446
                if (is_dir($directory. "/" . $file)) {
447
                    $array_items = array_merge($array_items, my_directory_to_array($directory. '/' . $file));
448
                    $file = $directory . "/" . $file;
449
                    $array_items[] = preg_replace("/\/\//si", '/', $file);
450
                }
451
            }
452
        }
453
        closedir($handle);
454
    }
455
    return $array_items;
456
}
457
458
/**
459
 * This function returns the value of a parameter from the configuration file

main/work/work.lib.php 1 location

@@ 966-982 (lines=17) @@
963
 * @author  Julio Montoya
964
 * @version April 2008
965
 */
966
function directory_to_array($directory)
967
{
968
    $array_items = array();
969
    if ($handle = @opendir($directory)) {
970
        while (false !== ($file = readdir($handle))) {
971
            if ($file != '.' && $file != '..') {
972
                if (is_dir($directory. '/' . $file)) {
973
                    $array_items = array_merge($array_items, directory_to_array($directory. '/' . $file));
974
                    $file = $directory . '/' . $file;
975
                    $array_items[] = preg_replace("/\/\//si", '/', $file);
976
                }
977
            }
978
        }
979
        closedir($handle);
980
    }
981
982
    return $array_items;
983
}
984
985
/**