src/TheTVDbAPI.php
public function performAPICall($method, $path, array $options = []): Response
    {
        $options = $this->getDefaultHttpClientOptions($options);
        // Reset JSON errors.
        $this->jsonErrors = [];
        // Reset Link section.
        $this->links = [];

        /* @type Response $response */
        $response = $this->httpClient->{$method}($path, $options);

        if ($response->getStatusCode() === 401) {
            throw UnauthorizedException::invalidToken();
        } elseif ($response->getStatusCode() === 404) {
            throw ResourceNotFoundException::notFound($path, $options);
        }

        return $response;
    }
public function performAPICall($method, $path, array $options = []): Response
    {
        $options = $this->getDefaultHttpClientOptions($options);
        // Reset JSON errors.
        $this->jsonErrors = [];
        // Reset Link section.
        $this->links = [];

        /* @type Response $response */
        $response = $this->httpClient->{$method}($path, $options);

        if ($response->getStatusCode() === 401) {
            throw UnauthorizedException::invalidToken();
        } elseif ($response->getStatusCode() === 404) {
            throw ResourceNotFoundException::notFound($path, $options);
        }

        return $response;
    }
public function performAPICall ( $ method , $ path , array $ options = [ ] ) : Response { $ options = $ this -> getDefaultHttpClientOptions ( $ options ) ; // Reset JSON errors. $ this -> jsonErrors = [ ] ; // Reset Link section. $ this -> links = [ ] ; /* @type Response $response */ $ response = $ this -> httpClient -> { $ method } ( $ path , $ options ) ; if ( $ response -> getStatusCode ( ) === 401 ) { throw UnauthorizedException :: invalidToken ( ) ; } elseif ( $ response -> getStatusCode ( ) === 404 ) { throw ResourceNotFoundException :: notFound ( $ path , $ options ) ; } return $ response ; }
Perform an API call to theTVDb.

@param string $method  HTTP Method (post, getUserData, put, etc.)
@param string $path    Path to the API call
@param array  $options HTTP Client options

@return Response
@throws UnauthorizedException
@throws ResourceNotFoundException
Perform an API call to theTVDb .