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

add_access_token_endpoint() приватный Метод

Add appropriate access token to endpoint.
private add_access_token_endpoint ( $git, $endpoint ) : string
$git
$endpoint
Результат string
    private function add_access_token_endpoint($git, $endpoint)
    {
        // This will return if checking during shiny updates.
        if (!isset(parent::$options)) {
            return $endpoint;
        }
        // Add GitHub.com access token.
        if (!empty(parent::$options['github_access_token'])) {
            $endpoint = add_query_arg('access_token', parent::$options['github_access_token'], $endpoint);
        }
        // Add GitHub Enterprise access token.
        if (!empty($git->type->enterprise) && !empty(parent::$options['github_enterprise_token'])) {
            $endpoint = remove_query_arg('access_token', $endpoint);
            $endpoint = add_query_arg('access_token', parent::$options['github_enterprise_token'], $endpoint);
        }
        // Add repo access token.
        if (!empty(parent::$options[$git->type->repo])) {
            $endpoint = remove_query_arg('access_token', $endpoint);
            $endpoint = add_query_arg('access_token', parent::$options[$git->type->repo], $endpoint);
        }
        return $endpoint;
    }