protected function buildRequest(string $method, string $url, array $options = []): array
    {
        if ($this->forcedAcceptJson) {
            $this->headers['accept'] = 'application/json';
        }
        if (count($this->headers) > 0) {
            if (!array_key_exists(RequestOptions::HEADERS, $options) || !is_array($options[RequestOptions::HEADERS])) {
                $options[RequestOptions::HEADERS] = [];
            }
            foreach ($this->headers as $headerName => $headerValue) {
                $options[RequestOptions::HEADERS][$headerName] = $headerValue;
            }
        }

        $options = $this->addAuthHeader($options);

        return [
            self::OPTION_METHOD => $method,
            self::OPTION_URL => $this->buildUrl($url),
            self::OPTION_OPTIONS => $options
        ];
    }
protected function buildRequest(string $method, string $url, array $options = []): array
    {
        if ($this->forcedAcceptJson) {
            $this->headers['accept'] = 'application/json';
        }
        if (count($this->headers) > 0) {
            if (!array_key_exists(RequestOptions::HEADERS, $options) || !is_array($options[RequestOptions::HEADERS])) {
                $options[RequestOptions::HEADERS] = [];
            }
            foreach ($this->headers as $headerName => $headerValue) {
                $options[RequestOptions::HEADERS][$headerName] = $headerValue;
            }
        }

        $options = $this->addAuthHeader($options);

        return [
            self::OPTION_METHOD => $method,
            self::OPTION_URL => $this->buildUrl($url),
            self::OPTION_OPTIONS => $options
        ];
    }
protected function buildRequest ( string $ method , string $ url , array $ options = [ ] ) : array { if ( $ this -> forcedAcceptJson ) { $ this -> headers [ 'accept' ] = 'application/json' ; } if ( count ( $ this -> headers ) > 0 ) { if ( ! array_key_exists ( RequestOptions :: HEADERS , $ options ) || ! is_array ( $ options [ RequestOptions :: HEADERS ] ) ) { $ options [ RequestOptions :: HEADERS ] = [ ] ; } foreach ( $ this -> headers as $ headerName => $ headerValue ) { $ options [ RequestOptions :: HEADERS ] [ $ headerName ] = $ headerValue ; } } $ options = $ this -> addAuthHeader ( $ options ) ; return [ self :: OPTION_METHOD => $ method , self :: OPTION_URL => $ this -> buildUrl ( $ url ) , self :: OPTION_OPTIONS => $ options ] ; }
Builds the options for the request
@param $method string
@param $url string
@param array $options
@return array
Builds the options for the request