Beispiel #1
0
function process_path($path)
{
    if (is_dir($path)) {
        //echo "dir: [$path]\n";
        $path = rtrim($path, "\\/") . "/";
        foreach (glob($path . "*", GLOB_ONLYDIR) as $subdir) {
            process_path($subdir);
        }
        foreach (glob($path . "*.class.php") as $file) {
            process_path($file);
        }
    } else {
        process_file($path);
    }
}
//6) если совпадения не выстрелили - выходим.
////
////
////
if (!$argv[0]) {
    die("This program may run CLI mode only.");
}
if (empty($argv[1])) {
    print "No arguments found! please set path to Folder to find doubles" . PHP_EOL;
    die;
}
$path = $argv[1];
if (!check_path($path)) {
    die("Not normal folder path given!");
}
process_path($path);
function check_path($path)
{
    return is_dir($path);
}
/**
 * @param $path string Folder to searching doubles;
 * Main controller - search for doubless and print result;
 */
function process_path($path)
{
    if (check_path($path)) {
        global $files;
        $files = array();
        global $results;
        $results = array();