<commit_before><?php
/**
 * Copyright (c) 2017, <NAME> (canihavesomecoffee) <<EMAIL>>
 *
 * Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby
 * granted, provided that the above copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 *
 * The main class for this library.
 *
 * PHP version 7.1
 *
 * @category TheTVDbAPI
 * @package  CanIHaveSomeCoffee\TheTVDbAPI
 * @author   <NAME> (canihavesomecoffee) <<EMAIL>>
 * @license  See start of document
 * @link     https://canihavesome.coffee/projects/theTVDbAPI
 */
declare(strict_types = 1);

namespace CanIHaveSomeCoffee\TheTVDbAPI;

use CanIHaveSomeCoffee\TheTVDbAPI\Exception\ParseException;
use CanIHaveSomeCoffee\TheTVDbAPI\Exception\ResourceNotFoundException;
use CanIHaveSomeCoffee\TheTVDbAPI\Exception\UnauthorizedException;
use CanIHaveSomeCoffee\TheTVDbAPI\Model\JSONError;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\AuthenticationRoute;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\EpisodesRoute;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\LanguagesRoute;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\RouteFactory;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\SearchRoute;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\SeriesRoute;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\UpdatesRoute;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\UsersRoute;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Response;
use InvalidArgumentException;

/**
 * Class TheTVDbAPI
 *
 * @category TheTVDbAPI
 * @package  CanIHaveSomeCoffee\TheTVDbAPI
 * @author   <NAME> (canihavesomecoffee) <<EMAIL>>
 * @license  See start of document
 * @link     https://canihavesome.coffee/projects/theTVDbAPI
 */
class TheTVDbAPI implements TheTVDbAPIInterface
{
    /**
     * Base URI to the API.
     *
     * @type string
     */
    const API_BASE_URI = 'https://api.thetvdb.com';

    /**
     * The actual HTTP client that will be used.
     *
     * @var Client
     */
    private $httpClient;

    /**
     * Token used for authentication purposes.
     *
     * @var string
     */
    private $token;

    /**
     * The language(s) to request results in. The first language will be
     * the primary, the others are fallback languages for when content is
     * missing in the primary language.
     *
     * @var array
     */
    protected $languages = ['en'];

    /**
     * The API version to request.
     *
     * @var string
     */
    private $version = '2.1.2';
    /**
     * Array containing the JSON errors from the last request.
     *
     * @var array
     */
    private $jsonErrors = [];
    /**
     * Array containing the pagination results from the last request.
     *
     * @var array
     */
    private $links = [];


    /**
     * TheTVDbAPI constructor.
     *
     * @param Client $client Optional parameter. If you pass one in you need to ensure that 'base_uri' and the
     *                       content-type of the headers are set in the options.
     */
    public function __construct(Client $client = null)
    {
        if ($client === null) {
            $client = new Client(
                [<commit_msg>Bump api version number to use<commit_after><?php
/**
 * Copyright (c) 2017, <NAME> (can<EMAIL>) <<EMAIL>>
 *
 * Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby
 * granted, provided that the above copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 *
 * The main class for this library.
 *
 * PHP version 7.1
 *
 * @category TheTVDbAPI
 * @package  CanIHaveSomeCoffee\TheTVDbAPI
 * @author   <NAME> (canihavesomecoffee) <<EMAIL>>
 * @license  See start of document
 * @link     https://canihavesome.coffee/projects/theTVDbAPI
 */
declare(strict_types = 1);

namespace CanIHaveSomeCoffee\TheTVDbAPI;

use CanIHaveSomeCoffee\TheTVDbAPI\Exception\ParseException;
use CanIHaveSomeCoffee\TheTVDbAPI\Exception\ResourceNotFoundException;
use CanIHaveSomeCoffee\TheTVDbAPI\Exception\UnauthorizedException;
use CanIHaveSomeCoffee\TheTVDbAPI\Model\JSONError;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\AuthenticationRoute;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\EpisodesRoute;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\LanguagesRoute;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\RouteFactory;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\SearchRoute;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\SeriesRoute;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\UpdatesRoute;
use CanIHaveSomeCoffee\TheTVDbAPI\Route\UsersRoute;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Response;
use InvalidArgumentException;

/**
 * Class TheTVDbAPI
 *
 * @category TheTVDbAPI
 * @package  CanIHaveSomeCoffee\TheTVDbAPI
 * @author   <NAME> (canihavesomecoffee) <<EMAIL>>
 * @license  See start of document
 * @link     https://canihavesome.coffee/projects/theTVDbAPI
 */
class TheTVDbAPI implements TheTVDbAPIInterface
{
    /**
     * Base URI to the API.
     *
     * @type string
     */
    const API_BASE_URI = 'https://api.thetvdb.com';

    /**
     * The actual HTTP client that will be used.
     *
     * @var Client
     */
    private $httpClient;

    /**
     * Token used for authentication purposes.
     *
     * @var string
     */
    private $token;

    /**
     * The language(s) to request results in. The first language will be
     * the primary, the others are fallback languages for when content is
     * missing in the primary language.
     *
     * @var array
     */
    protected $languages = ['en'];

    /**
     * The API version to request.
     *
     * @var string
     */
    private $version = '3.0.0';
    /**
     * Array containing the JSON errors from the last request.
     *
     * @var array
     */
    private $jsonErrors = [];
    /**
     * Array containing the pagination results from the last request.
     *
     * @var array
     */
    private $links = [];


    /**
     * TheTVDbAPI constructor.
     *
     * @param Client $client Optional parameter. If you pass one in you need to ensure that 'base_uri' and the
     *                       content-type of the headers are set in the options.
     */
    public function __construct(Client $client = null)
    {
        if ($client === null) {
            $client = new Client(
                [
{'fraction_non_alphanumeric': 0.08807792564137742, 'fraction_numerical': 0.003018246673069008, 'mean_word_length': 3.1420454545454546, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 22, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '722649', 'n_tokens_mistral': 2296, 'n_tokens_neox': 2180, 'n_words': 681}