<commit_before><?php
/**
 * Created by IntelliJ IDEA.
 * User: stopka
 * Date: 22.11.18
 * Time: 16:16
 */

namespace Stopka\OpenviduPhpClient\Rest;

use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use Psr\Http\Message\ResponseInterface;

class RestClient
{
    /** @var Client */
    private $httpClient;

    const HEADER_ACCEPT = "Accept";
    const MIME_JSON = "application/json";

    /**
     * RestClient constructor.
     * @param string $baseUri
     * @param string $username
     * @param string $password
     */
    public function __construct(string $baseUri, string $username, string $password)
    {
        $this->httpClient = new Client([
            'base_uri' => $baseUri,
            'auth' => [$username, $password],
            'headers' => [
                self::HEADER_ACCEPT => self::MIME_JSON
            ]
        ]);
    }

    /**
     * @param array $data
     * @return array
     */
    private function prepareOptions(array $data = []): array
    {
        return [<commit_msg>Add option to allow Guzzle client without SSL cert verification<commit_after><?php
/**
 * Created by IntelliJ IDEA.
 * User: stopka
 * Date: 22.11.18
 * Time: 16:16
 */

namespace Stopka\OpenviduPhpClient\Rest;

use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use Psr\Http\Message\ResponseInterface;

class RestClient
{
    /** @var Client */
    private $httpClient;

    const HEADER_ACCEPT = "Accept";
    const MIME_JSON = "application/json";

    /**
     * RestClient constructor.
     * @param string $baseUri
     * @param string $username
     * @param string $password
     * @param bool   $verify
     */
    public function __construct(string $baseUri, string $username, string $password, bool $verify = true)
    {
        $this->httpClient = new Client([
            'base_uri' => $baseUri,
            'auth'     => [$username, $password],
            'headers'  => [self::HEADER_ACCEPT => self::MIME_JSON],
            'verify'   => $verify,
        ]);
    }

    /**
     * @param array $data
     * @return array
     */
    private function prepareOptions(array $data = []): array
    {
        return [
{'fraction_non_alphanumeric': 0.12759097190234914, 'fraction_numerical': 0.009212344541685858, 'mean_word_length': 2.39906103286385, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '6924638', 'n_tokens_mistral': 676, 'n_tokens_neox': 647, 'n_words': 161}