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

add_endpoints() защищенный Метод

Create GitHub API endpoints.
protected add_endpoints ( $git, $endpoint ) : string
$git object
$endpoint string
Результат string $endpoint
    protected function add_endpoints($git, $endpoint)
    {
        /*
         * If a branch has been given, only check that for the remote info.
         * If it's not been given, GitHub will use the Default branch.
         */
        if (!empty($git->type->branch)) {
            $endpoint = add_query_arg('ref', $git->type->branch, $endpoint);
        }
        $endpoint = $this->add_access_token_endpoint($git, $endpoint);
        /*
         * Remove branch endpoint if a translation file.
         */
        $repo = explode('/', $endpoint);
        if (isset($repo[3]) && $repo[3] !== $git->type->repo) {
            $endpoint = remove_query_arg('ref', $endpoint);
        }
        /*
         * If using GitHub Enterprise header return this endpoint.
         */
        if (!empty($git->type->enterprise_api)) {
            return $git->type->enterprise_api . $endpoint;
        }
        return $endpoint;
    }