<commit_before><?php

namespace RAPL\RAPL\Connection;

use GuzzleHttp\Client;
use GuzzleHttp\Message\RequestInterface;
use Symfony\Bridge\Monolog\Logger;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Event\SubscriberInterface;
use GuzzleHttp\Event\EmitterInterface;
use GuzzleHttp\Message\Response;
use Symfony\Component\Stopwatch\Stopwatch;

class Connection implements ConnectionInterface
{
    /**
     * @var ClientInterface
     */
    protected $httpClient;

    /**
     * @var Logger
     */
    protected $logger;

    /**
     * @var Stopwatch
     */
    protected $stopwatch;

    /**
     * @param string $baseUrl
     */
    public function __construct($baseUrl, Logger $logger = null, Stopwatch $stopwatch = null)
    {
        $this->httpClient = new Client(['base_url' => $baseUrl]);
        $this->logger = $logger;
        $this->stopwatch = $stopwatch;
    }

    /**
     * @param string $method
     * @param string $uri
     *
     * @return RequestInterface
     */
    public function createRequest($method = 'GET', $url = null, array $options = array())
    {
        //NEW
        return $this->httpClient->createRequest($method, $url, $options);
    }

    /**
     * @param RequestInterface $request
     *
     * @return Response
     */
    public function sendRequest(RequestInterface $request)
    {
        if ($this->logger !== null) {
            $timestart = microtime(true);
            $this->logger->addInfo('[RAPL] Webservice called : ' . $request->getMethod() . ' ' .$request->getPath() . ' [' . $page_load_time . 's]');
        }
        if ($this->stopwatch) {<commit_msg>[DEBUG] Logger - Fix undefined variable page_load_time<commit_after><?php

namespace RAPL\RAPL\Connection;

use GuzzleHttp\Client;
use GuzzleHttp\Message\RequestInterface;
use Symfony\Bridge\Monolog\Logger;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Event\SubscriberInterface;
use GuzzleHttp\Event\EmitterInterface;
use GuzzleHttp\Message\Response;
use Symfony\Component\Stopwatch\Stopwatch;

class Connection implements ConnectionInterface
{
    /**
     * @var ClientInterface
     */
    protected $httpClient;

    /**
     * @var Logger
     */
    protected $logger;

    /**
     * @var Stopwatch
     */
    protected $stopwatch;

    /**
     * @param string $baseUrl
     */
    public function __construct($baseUrl, Logger $logger = null, Stopwatch $stopwatch = null)
    {
        $this->httpClient = new Client(['base_url' => $baseUrl]);
        $this->logger = $logger;
        $this->stopwatch = $stopwatch;
    }

    /**
     * @param string $method
     * @param string $uri
     *
     * @return RequestInterface
     */
    public function createRequest($method = 'GET', $url = null, array $options = array())
    {
        //NEW
        return $this->httpClient->createRequest($method, $url, $options);
    }

    /**
     * @param RequestInterface $request
     *
     * @return Response
     */
    public function sendRequest(RequestInterface $request)
    {
        if ($this->logger !== null) {
            $timestart = microtime(true);
            $this->logger->addInfo('[RAPL] Webservice called : ' . $request->getMethod() . ' ' .$request->getPath());
        }
        if ($this->stopwatch) {
{'fraction_non_alphanumeric': 0.13319489765648176, 'fraction_numerical': 0.0, 'mean_word_length': 2.7054945054945057, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '1658881', 'n_tokens_mistral': 1004, 'n_tokens_neox': 980, 'n_words': 207}