pharext\Packager::download PHP Method

download() private method

Download remote source
private download ( string $source ) : string
$source string
return string local source
    private function download($source)
    {
        if ($this->args->git) {
            $task = new Task\GitClone($source, $this->args->branch);
        } else {
            /* print newline only once */
            $done = false;
            $task = new Task\StreamFetch($source, function ($bytes_pct) use(&$done) {
                if (!$done) {
                    $this->info(" %3d%% [%s>%s] \r", floor($bytes_pct * 100), str_repeat("=", round(50 * $bytes_pct)), str_repeat(" ", round(50 * (1 - $bytes_pct))));
                    if ($bytes_pct == 1) {
                        $done = true;
                        $this->info("\n");
                    }
                }
            });
        }
        $local = $task->run($this->verbosity());
        $this->cleanup[] = new Task\Cleanup($local);
        return $local;
    }