Fragen\GitHub_Updater\GitHub_API::construct_download_link PHP Метод

    public function construct_download_link($rollback = false, $branch_switch = false)
    {
        /*
         * Check if using GitHub Self-Hosted.
         */
        if (!empty($this->type->enterprise_api)) {
            $github_base = $this->type->enterprise_api;
        } else {
            $github_base = 'https://api.github.com';
        }
        $download_link_base = implode('/', array($github_base, 'repos', $this->type->owner, $this->type->repo, 'zipball/'));
        $endpoint = '';
        /*
         * If release asset.
         */
        if ($this->type->release_asset && '0.0.0' !== $this->type->newest_tag) {
            return $this->get_github_release_asset_url();
        }
        /*
         * Check for rollback.
         */
        if (!empty($_GET['rollback']) && (isset($_GET['action']) && 'upgrade-theme' === $_GET['action']) && (isset($_GET['theme']) && $this->type->repo === $_GET['theme'])) {
            $endpoint .= $rollback;
            /*
             * For users wanting to update against branch other than master
             * or if not using tags, else use newest_tag.
             */
        } elseif ('master' != $this->type->branch || empty($this->type->tags)) {
            $endpoint .= $this->type->branch;
        } else {
            $endpoint .= $this->type->newest_tag;
        }
        /*
         * Create endpoint for branch switching.
         */
        if ($branch_switch) {
            $endpoint = $branch_switch;
        }
        $endpoint = $this->add_access_token_endpoint($this, $endpoint);
        return $download_link_base . $endpoint;
    }