<commit_before><?php
namespace AAlakkad\AjaxForwarder\Repositories;

use Config;

class ApiGuzzle implements ApiRepository
{
    protected $client;

    public function __construct()
    {
        $configKey = "forwarder";
        $base_url  = Config::get("{$configKey}.servers.default.host");

        // Setup guzzle client with base url.
        $this->client = new \GuzzleHttp\Client(
            [
                'base_url' => $base_url,
            ]
        );
    }

    public function sendRequest($path, array $data = [])
    {
        if (count($data)) {
            $path .= '?';
            $path .= http_build_query($data);
        }
        return $response = $this->client->get($path);
    }
}<commit_msg>Repositories - Api: merge default data before sending the request<commit_after><?php
namespace AAlakkad\AjaxForwarder\Repositories;

use Config;

class ApiGuzzle implements ApiRepository
{
    protected $client;

    public function __construct()
    {
        $configKey = "forwarder";
        $base_url  = Config::get("{$configKey}.servers.default.host");

        // Setup guzzle client with base url.
        $this->client = new \GuzzleHttp\Client(
            [
                'base_url' => $base_url,
            ]
        );
    }

    public function sendRequest($path, array $data = [])
    {
        // Get default args from config
        $configKey   = "forwarder";
        $defaultArgs = Config::get("{$configKey}.servers.default.data", []);
        // Append default args
        $data = array_merge($defaultArgs, $data);
        if (count($data)) {
            $path .= '?';
            $path .= http_build_query($data);
        }
        return $response = $this->client->get($path);
    }
}
{'fraction_non_alphanumeric': 0.13583815028901733, 'fraction_numerical': 0.0, 'mean_word_length': 2.085561497326203, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '5098073', 'n_tokens_mistral': 513, 'n_tokens_neox': 506, 'n_words': 107}