src/PackagerHelper.php
public function removeDir($path)
    {
        if ($path == 'packages' or $path == '/') {
            return false;
        }

        $files = array_diff(scandir($path), ['.', '..']);
        foreach ($files as $file) {
            if (is_dir("$path/$file")) {
                $this->removeDir("$path/$file");
            } else {
                @chmod("$path/$file", 0777);
                @unlink("$path/$file");
            }

        }
        return rmdir($path);
    }
public function removeDir($path)
    {
        if ($path == 'packages' or $path == '/') {
            return false;
        }

        $files = array_diff(scandir($path), ['.', '..']);
        foreach ($files as $file) {
            if (is_dir("$path/$file")) {
                $this->removeDir("$path/$file");
            } else {
                @chmod("$path/$file", 0777);
                @unlink("$path/$file");
            }

        }
        return rmdir($path);
    }
public function removeDir ( $ path ) { if ( $ path == 'packages' or $ path == '/' ) { return false ; } $ files = array_diff ( scandir ( $ path ) , [ '.' , '..' ] ) ; foreach ( $ files as $ file ) { if ( is_dir ( "$path/$file" ) ) { $ this -> removeDir ( "$path/$file" ) ; } else { @ chmod ( "$path/$file" , 0777 ) ; @ unlink ( "$path/$file" ) ; } } return rmdir ( $ path ) ; }
Remove a directory if it exists.

@param  string $path Path of the directory to remove.

@return void
Remove a directory if it exists .