<commit_before><?php

namespace AppBundle\API;

use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;

class TwitterAPIClient
{
    /**
     * @var ClientInterface
     */
    private $client;

    private $consumerKey = ''; // api key
    private $consumerSecret = ''; // api secret
    private $bearerToken = '';

    // #TODO: endpoint
    private $requestUrl = ''; // decide by api call method

    public function __construct(array $config)
    {
        $this->client = new Client(['timeout' => 10.0]);
        $this->consumerKey = $config['consumer_key'];
        $this->consumerSecret = $config['consumer_secret'];
        $this->bearerToken = $config['bearer_token'];
    }

    /**
     * call api https://api.twitter.com/1.1/statuses/user_timeline.json.
     *
     * @param array $getQuery
     *
     * @return stdClass $decoded_json
     */
    public function callStatusesUserTimeline(array $getQuery = [])
    {
        $this->requestUrl = 'https://api.twitter.com/1.1/statuses/user_timeline.json';

        if ($getQuery) {
            $this->requestUrl = $this->concatGetQuery($this->requestUrl, $getQuery);
        }

        $response = $this->get($this->requestUrl, $this->createHeader());

        return $response;
    }

    /**
     * call api https://api.twitter.com/1.1/search/tweets.json.
     *<commit_msg>endpoint phpdoc<commit_after><?php

namespace AppBundle\API;

use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;

class TwitterAPIClient
{
    /**
     * @var ClientInterface
     */
    private $client;

    private $consumerKey = ''; // api key
    private $consumerSecret = ''; // api secret
    private $bearerToken = '';

    // #TODO: endpoint
    private $requestUrl = ''; // decide by api call method

    public function __construct(array $config)
    {
        $this->client = new Client(['timeout' => 10.0]);
        $this->consumerKey = $config['consumer_key'];
        $this->consumerSecret = $config['consumer_secret'];
        $this->bearerToken = $config['bearer_token'];
    }

    /**
     * GET statuses/user_timeline.
     *
     * https://dev.twitter.com/rest/reference/get/statuses/user_timeline
     *
     * @param array $getQuery
     *
     * @return stdClass $decoded_json
     */
    public function callStatusesUserTimeline(array $getQuery = [])
    {
        $this->requestUrl = 'https://api.twitter.com/1.1/statuses/user_timeline.json';

        if ($getQuery) {
            $this->requestUrl = $this->concatGetQuery($this->requestUrl, $getQuery);
        }

        $response = $this->get($this->requestUrl, $this->createHeader());

        return $response;
    }

    /**
     * GET search/tweets.
     *
     * https://dev.twitter.com/rest/reference/get/search/tweets
     *
{'fraction_non_alphanumeric': 0.1513277555474718, 'fraction_numerical': 0.005092761004001455, 'mean_word_length': 2.516624040920716, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '5700259', 'n_tokens_mistral': 870, 'n_tokens_neox': 838, 'n_words': 149}