private function executeRequest(
        string $method,
        string $url,
        array $parameters = []
    ) {
        $parameters = $this->mergeDefaultParameters($parameters);

        $startTime = null;
        if ($this->isHistoryLogged()) {
            $startTime = microtime(true);
        }

        try {
            $response = $this->httpClient->request($method, $url, $parameters);
            $this->logRequest(
                $startTime,
                $method,
                $url,
                $parameters,
                $response
            );
        } catch (RequestException $e) {
            $this->logRequest(
                $startTime,
                $method,
                $url,
                $parameters,
                $e->getResponse()
            );
            throw $e;
        } catch (TransferException $e) {
            $this->logRequest($startTime, $method, $url, $parameters);
            throw $e;
        }

        $headers = $response->getHeaders();
        $jsonContentTypeList = ['application/ld+json', 'application/json'];

        $requestIsJson = false;

        if (isset($headers['Content-Type'])) {
            foreach ($jsonContentTypeList as $contentType) {
                if (
                    false !==
                    mb_stripos($headers['Content-Type'][0], $contentType)
                ) {
                    $requestIsJson = true;
                    break;
                }
            }
        }

        if ($requestIsJson) {
            return json_decode((string) $response->getBody(), true);
        } else {
            return $response;
        }
    }
private function executeRequest(
        string $method,
        string $url,
        array $parameters = []
    ) {
        $parameters = $this->mergeDefaultParameters($parameters);

        $startTime = null;
        if ($this->isHistoryLogged()) {
            $startTime = microtime(true);
        }

        try {
            $response = $this->httpClient->request($method, $url, $parameters);
            $this->logRequest(
                $startTime,
                $method,
                $url,
                $parameters,
                $response
            );
        } catch (RequestException $e) {
            $this->logRequest(
                $startTime,
                $method,
                $url,
                $parameters,
                $e->getResponse()
            );
            throw $e;
        } catch (TransferException $e) {
            $this->logRequest($startTime, $method, $url, $parameters);
            throw $e;
        }

        $headers = $response->getHeaders();
        $jsonContentTypeList = ['application/ld+json', 'application/json'];

        $requestIsJson = false;

        if (isset($headers['Content-Type'])) {
            foreach ($jsonContentTypeList as $contentType) {
                if (
                    false !==
                    mb_stripos($headers['Content-Type'][0], $contentType)
                ) {
                    $requestIsJson = true;
                    break;
                }
            }
        }

        if ($requestIsJson) {
            return json_decode((string) $response->getBody(), true);
        } else {
            return $response;
        }
    }
private function executeRequest ( string $ method , string $ url , array $ parameters = [ ] ) { $ parameters = $ this -> mergeDefaultParameters ( $ parameters ) ; $ startTime = null ; if ( $ this -> isHistoryLogged ( ) ) { $ startTime = microtime ( true ) ; } try { $ response = $ this -> httpClient -> request ( $ method , $ url , $ parameters ) ; $ this -> logRequest ( $ startTime , $ method , $ url , $ parameters , $ response ) ; } catch ( RequestException $ e ) { $ this -> logRequest ( $ startTime , $ method , $ url , $ parameters , $ e -> getResponse ( ) ) ; throw $ e ; } catch ( TransferException $ e ) { $ this -> logRequest ( $ startTime , $ method , $ url , $ parameters ) ; throw $ e ; } $ headers = $ response -> getHeaders ( ) ; $ jsonContentTypeList = [ 'application/ld+json' , 'application/json' ] ; $ requestIsJson = false ; if ( isset ( $ headers [ 'Content-Type' ] ) ) { foreach ( $ jsonContentTypeList as $ contentType ) { if ( false !== mb_stripos ( $ headers [ 'Content-Type' ] [ 0 ] , $ contentType ) ) { $ requestIsJson = true ; break ; } } } if ( $ requestIsJson ) { return json_decode ( ( string ) $ response -> getBody ( ) , true ) ; } else { return $ response ; } }
Executes request.

@return ResponseInterface|array

@throws TransferException
Executes request .