<commit_before><?php

/*
 * This file is part of the HWIOAuthBundle package.
 *
 * (c) Hardware.Info <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use HWI\Bundle\OAuthBundle\Security\Core\Authentication\Token\OAuthToken;

/**
 * MailRuResourceOwner
 *
 * @author <NAME> <<EMAIL>>
 */
class MailRuResourceOwner extends GenericOAuth2ResourceOwner
{
    /**
     * {@inheritDoc}
     */
    protected $options = array(
        'authorization_url'   => 'https://connect.mail.ru/oauth/authorize',
        'access_token_url'    => 'https://connect.mail.ru/oauth/token',
        'infos_url'           => 'http://www.appsmail.ru/platform/api',
    );

    /**
     * {@inheritDoc}
     */
    protected $paths = array(
        'identifier' => 'uid',
        'nickname'   => 'nick',
        'realname'   => 'nick',
        'email'      => 'email',
    );

    /**
     * {@inheritDoc}
     */
    public function getUserInformation(array $accessToken, array $extraParameters = array())
    {
        $params = array(
            'app_id'    => $this->getOption('client_id'),
            'method' => 'users.getInfo',
            'secure' => '1',
            'session_key' => $accessToken['access_token'],
        );

        $sig = vprintf('app_id=%smethod=%ssecure=%ssession_key=%s', $params);

        $params['sig'] = md5($sig . $this->getOption('client_secret'));

        $url = $this->normalizeUrl($this->getOption('infos_url'), $params);

        $content = $this->doGetUserInformationRequest($url)->getContent();
        $content = json_decode($content);
        if (isset($content[0])) {
            $content = (array) $content[0];
        }

        $response = $this->getUserResponse();
        $response->setResponse($content);
        $response->setResourceOwner($this);
        $response->setOAuthToken(new OAuthToken($accessToken));

        return $response;
    }
}<commit_msg>Fix wrong function usage in MailRuResourceOwner<commit_after><?php

/*
 * This file is part of the HWIOAuthBundle package.
 *
 * (c) Hardware.Info <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner;

use HWI\Bundle\OAuthBundle\Security\Core\Authentication\Token\OAuthToken;

/**
 * MailRuResourceOwner
 *
 * @author <NAME> <<EMAIL>>
 */
class MailRuResourceOwner extends GenericOAuth2ResourceOwner
{
    /**
     * {@inheritDoc}
     */
    protected $options = array(
        'authorization_url'   => 'https://connect.mail.ru/oauth/authorize',
        'access_token_url'    => 'https://connect.mail.ru/oauth/token',
        'infos_url'           => 'http://www.appsmail.ru/platform/api',
    );

    /**
     * {@inheritDoc}
     */
    protected $paths = array(
        'identifier' => 'uid',
        'nickname'   => 'nick',
        'realname'   => 'nick',
        'email'      => 'email',
    );

    /**
     * {@inheritDoc}
     */
    public function getUserInformation(array $accessToken, array $extraParameters = array())
    {
        $params = array(
            'app_id'      => $this->getOption('client_id'),
            'method'      => 'users.getInfo',
            'secure'      => '1',
            'session_key' => $accessToken['access_token'],
        );

        $params['sig'] = md5(vsprintf('app_id=%smethod=%ssecure=%ssession_key=%s', $params).$this->getOption('client_secret'));

        $url = $this->normalizeUrl($this->getOption('infos_url'), $params);

        $content = $this->doGetUserInformationRequest($url)->getContent();
        $content = json_decode($content);
        if (isset($content[0])) {
            $content = (array) $content[0];
        }

        $response = $this->getUserResponse();
        $response->setResponse($content);
        $response->setResourceOwner($this);
        $response->setOAuthToken(new OAuthToken($accessToken));

        return $response;
    }
}
{'fraction_non_alphanumeric': 0.16247865333008052, 'fraction_numerical': 0.0024396194193705783, 'mean_word_length': 2.6219081272084805, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 55, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '3006310', 'n_tokens_mistral': 1250, 'n_tokens_neox': 1230, 'n_words': 220}