<commit_before><?php

namespace SocialiteProviders\SciStarter;

use GuzzleHttp\ClientInterface;
use SocialiteProviders\Manager\OAuth2\User;
use Laravel\Socialite\Two\ProviderInterface;
use SocialiteProviders\Manager\OAuth2\AbstractProvider;

class Provider extends AbstractProvider implements ProviderInterface
{
    /**
     * Unique Provider Identifier.
     */
    const IDENTIFIER = 'SCISTARTER';

    /**
     * {@inheritdoc}
     */
    protected $scopes = ['login'];

    /**
     * {@inheritdoc}
     */
    protected function getAuthUrl($state)
    {
        return $this->buildAuthUrlFromBase('https://scistarter.com/authorize', $state);
    }

    /**
     * {@inheritdoc}
     */
    protected function getTokenUrl()
    {
        return 'https://scistarter.com/token';
    }

    /**
     * {@inheritdoc}
     */
    protected function getUserByToken($token)
    {
        $response = $this->getHttpClient()->get('https://scistarter.com/api/user_info', [
            'headers' => [
                'Authorization' => 'Bearer '.$token,
            ],
        ]);

        return json_decode($response->getBody(), true);
    }

    /**
     * {@inheritdoc}
     */
    protected function mapUserToObject(array $user)
    {
        return (new User())->setRaw($user)->map([
          'id' => array_get($user, 'user_id'),
          'profile_id' => array_get($user, 'profile_id'),
          'profile_url' => array_get($user, 'url'),
        ]);
    }

    /**
     * {@inheritdoc}
     */
    protected function getTokenFields($code)
    {
        return [
          'client_id' => $this->clientId,<commit_msg>[SciStarter] get user nickname, first name, last name, and email (#52)<commit_after><?php

namespace SocialiteProviders\SciStarter;

use GuzzleHttp\ClientInterface;
use SocialiteProviders\Manager\OAuth2\User;
use Laravel\Socialite\Two\ProviderInterface;
use SocialiteProviders\Manager\OAuth2\AbstractProvider;

class Provider extends AbstractProvider implements ProviderInterface
{
    /**
     * Unique Provider Identifier.
     */
    const IDENTIFIER = 'SCISTARTER';

    /**
     * {@inheritdoc}
     */
    protected $scopes = ['login extensive'];

    /**
     * {@inheritdoc}
     */
    protected function getAuthUrl($state)
    {
        return $this->buildAuthUrlFromBase('https://scistarter.com/authorize', $state);
    }

    /**
     * {@inheritdoc}
     */
    protected function getTokenUrl()
    {
        return 'https://scistarter.com/token';
    }

    /**
     * {@inheritdoc}
     */
    protected function getUserByToken($token)
    {
        $response = $this->getHttpClient()->get('https://scistarter.com/api/user_info', [
            'headers' => [
                'Authorization' => 'Bearer '.$token,
            ],
            'query' => [
              'client_id' => $this->client_id,
              'key' => $this->clientSecret,
            ],
        ]);

        return json_decode($response->getBody(), true);
    }

    /**
     * {@inheritdoc}
     */
    protected function mapUserToObject(array $user)
    {
        return (new User())->setRaw($user)->map([
          'id' => array_get($user, 'user_id'),
          'nickname' => array_get($user, 'handle'),
          'email' => array_get($user, 'email'),
          'first_name' => array_get($user, 'first_name'),
          'last_name' => array_get($user, 'last_name'),
          'profile_id' => array_get($user, 'profile_id'),
          'profile_url' => array_get($user, 'url'),
        ]);
    }

    /**
     * {@inheritdoc}
     */
    protected function getTokenFields($code)
    {
        return [
          'client_id' => $this->clientId,
{'fraction_non_alphanumeric': 0.15542763157894737, 'fraction_numerical': 0.001644736842105263, 'mean_word_length': 2.3112522686025407, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 38, 'https://': 6, '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': '7528956', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1091, 'n_words': 181}