<commit_before><?php
namespace Pwnraid\Bnet;

use League\OAuth2\Client\Provider\IdentityProvider;
use League\OAuth2\Client\Provider\User;
use League\OAuth2\Client\Token\AccessToken;

class OAuth extends IdentityProvider
{
    public $scopeSeparator = ' ';
    public $scopes = ['wow.profile', 'sc2.profile'];

    protected $region;

    public function __construct(Region $region, $options = array())
    {
        $this->region = $region;
        parent::__construct($options);
    }

    public function urlAuthorize()
    {
        return $this->region->getOAuthHost().'oauth/authorize';
    }

    public function urlAccessToken()
    {
        return $this->region->getOAuthHost().'oauth/token';
    }

    public function urlUserDetails(AccessToken $token)
    {
        return $this->region->getApiHost('account').'user/id?access_token='.$token;
    }

    public function userDetails($response, AccessToken $token)
    {
        $user      = new User;
        $user->uid = $response->id;
        $client    = $this->getHttpClient();

        $client->setBaseUrl($this->region->getApiHost('account').'user/battletag?access_token='.$token);

        $response        = $client->get()->send()->json();
        $user->battleTag = $response->battletag;

        return $user;
    }

    public function userUid($response, AccessToken $token)
    {
        return $response->id;
    }

    public function userEmail($response, AccessToken $token)
    {
    }

    public function userScreenName($response, AccessToken $token)
    {
    }
}
<commit_msg>OAuth fixes.<commit_after><?php
namespace Pwnraid\Bnet;

use League\OAuth2\Client\Provider\IdentityProvider;
use League\OAuth2\Client\Token\AccessToken;

class OAuth extends IdentityProvider
{
    public $scopeSeparator = ' ';
    public $scopes = ['wow.profile', 'sc2.profile'];

    protected $region;

    public function __construct(Region $region, $options = array())
    {
        $this->region = $region;
        parent::__construct($options);
    }

    public function urlAuthorize()
    {
        return $this->region->getOAuthHost().'oauth/authorize';
    }

    public function urlAccessToken()
    {
        return $this->region->getOAuthHost().'oauth/token';
    }

    public function urlUserDetails(AccessToken $token)
    {
        return $this->region->getApiHost('account').'user/id?access_token='.$token;
    }

    public function userDetails($response, AccessToken $token)
    {
        $user       = [];
        $user['id'] = $response->id;
        $client     = $this->getHttpClient();

        $client->setBaseUrl($this->region->getApiHost('account').'user/battletag?access_token='.$token);

        $response          = $client->get()->send()->json();
        $user['battleTag'] = $response['battletag'];

        return $user;
    }

    public function userUid($response, AccessToken $token)
    {
        return $response->id;
    }

    public function userEmail($response, AccessToken $token)
    {
    }

    public function userScreenName($response, AccessToken $token)
    {
    }
}

{'fraction_non_alphanumeric': 0.14453125, 'fraction_numerical': 0.0022786458333333335, 'mean_word_length': 2.8948035487959443, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '292737', 'n_tokens_mistral': 934, 'n_tokens_neox': 912, 'n_words': 161}