<commit_before><?php

/**
 * This file contains an OAuth Connection Class
 * for Linkedin.
 *
 * PHP Version 5.3
 *
 * @category   Libraries
 * @package    OAuth
 * @subpackage Libraries
 * @author     M2Mobi <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 */

/**
 * Linkedin OAuth Connection Class
 *
 * @category   Libraries
 * @package    OAuth
 * @subpackage Libraries
 * @author     M2Mobi <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 */
class LinkedinConnection implements OAuthConnectionInterface
{
    /**
     * Object to handle the API connection
     * @var Object
     */
    private $handler;

    /**
     * API access token
     * @var String
     */
    private $token;

    /**
     * Constructor.
     *
     * @param String $token User access token
     */
    public function __construct($token)
    {
        global $config;

        $this->token = $token;

        try
        {
            $this->handler = new OAuth(
                    $config['social']['linkedin']['consumer_key'],
                    $config['social']['linkedin']['consumer_secret'],
                    OAUTH_SIG_METHOD_HMACSHA1,
                    OAUTH_AUTH_TYPE_URI
                );

            $this->handler->setNonce(rand());
        }
        catch (Exception $e)
        {
           $this->handler = FALSE;
        }
    }

    /**
     * Destructor.
     */
    public function __destruct()
    {
        unset($this->token);
        unset($this->handler);
    }

    /**
     * Get the request token.
     *
     * @param String $callback Url to redirect back
     *
     * @return Array Array containing the 'oauth token secret' and the 'request token secret'
     */
    public function get_request_token($callback)
    {
        global $config;

        return $this->handler->getRequestToken(
                $config['social']['linkedin']['request_token_url'],
                $callback
            );
    }

    /**
     * Get access token.
     *
     * @param String $oauth_token          Oauth token
     * @param String $request_token_secret Request token secret
     *
     * @return Array containing the 'oauth token' and the 'oauth token secret'
     */
    public function get_access_token($oauth_token, $request_token_secret)
    {
        global $config;

        $this->handler->setToken($oauth_token, $request_token_secret);
        return $this->handler->getAccessToken($config['social']['linkedin']['access_token_url']);
    }

    public function login()
    {

    }

    public function get_user_info()
    {

    }

    public function post_message()
    {

    }
}<commit_msg>oauth: make LinkedInConnection class inherit from OAuthConnection class.<commit_after><?php

/**
 * This file contains an OAuth Connection Class
 * for Linkedin.
 *
 * PHP Version 5.3
 *
 * @category   Libraries
 * @package    OAuth
 * @subpackage Libraries
 * @author     M2Mobi <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 */

/**
 * Linkedin OAuth Connection Class
 *
 * @category   Libraries
 * @package    OAuth
 * @subpackage Libraries
 * @author     M2Mobi <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 */
class LinkedinConnection extends OAuthConnection
{

    const NETWORK = 'linkedin';

    /**
     * Constructor.
     *
     * @param String $token User access token
     */
    public function __construct($token)
    {
        parent::__construct($token);
    }

    /**
     * Destructor.
     */
    public function __destruct()
    {
        parent::__destruct();
    }

    /**
     * Get the request token.
     *
     * @param String $callback Url to redirect back
     *
     * @return Array Array containing the 'oauth token secret' and the 'request token secret'
     */
    public function get_request_token($callback)
    {
        global $config;

        return $this->handler->getRequestToken(
                $config['social']['linkedin']['request_token_url'],
                $callback
            );
    }

    /**
     * Get access token.
     *
     * @param String $oauth_token          Oauth token
     * @param String $request_token_secret Request token secret
     *
     * @return Array containing the 'oauth token' and the 'oauth token secret'
     */
    public function get_access_token($oauth_token, $request_token_secret)
    {
        global $config;

        $this->handler->setToken($oauth_token, $request_token_secret);
        return $this->handler->getAccessToken($config['social']['linkedin']['access_token_url']);
    }

    public function login()
    {

    }

    public function get_user_info()
    {

    }

    public function post_message()
    {

    }
}
{'fraction_non_alphanumeric': 0.12085811384876806, 'fraction_numerical': 0.0019116397621070519, 'mean_word_length': 2.0939553219448093, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 51, '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': '2648867', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1342, 'n_words': 330}