private function setOAuthHeaders(RequestInterface $request): RequestInterface
    {
        $now = new \DateTime();
        if ($this->now instanceof \DateTime) {
            $now = clone $this->now;
        }

        //Generate HTTP headers
        $encodedKey = \rawurlencode($this->oauthConsumerSecret).'&'.\rawurlencode($this->oauthAccessTokenSecret);
        $oauthParams = [
            'oauth_consumer_key' => $this->oauthConsumerKey,
            'oauth_token' => $this->oauthAccessToken,
            'oauth_nonce' => \sha1(\microtime(true).\rand(10000, 99999)),
            'oauth_timestamp' => $now->getTimestamp(),
            'oauth_signature_method' => 'PLAINTEXT',
            'oauth_version' => '1.0',
            'oauth_signature' => $encodedKey,
        ];

        $request = $request->withHeader('Authorization', $this->encodeOAuthHeaders($oauthParams));

        return $request->withHeader('Expect', '');
    }
private function setOAuthHeaders(RequestInterface $request): RequestInterface
    {
        $now = new \DateTime();
        if ($this->now instanceof \DateTime) {
            $now = clone $this->now;
        }

        //Generate HTTP headers
        $encodedKey = \rawurlencode($this->oauthConsumerSecret).'&'.\rawurlencode($this->oauthAccessTokenSecret);
        $oauthParams = [
            'oauth_consumer_key' => $this->oauthConsumerKey,
            'oauth_token' => $this->oauthAccessToken,
            'oauth_nonce' => \sha1(\microtime(true).\rand(10000, 99999)),
            'oauth_timestamp' => $now->getTimestamp(),
            'oauth_signature_method' => 'PLAINTEXT',
            'oauth_version' => '1.0',
            'oauth_signature' => $encodedKey,
        ];

        $request = $request->withHeader('Authorization', $this->encodeOAuthHeaders($oauthParams));

        return $request->withHeader('Expect', '');
    }
private function setOAuthHeaders ( RequestInterface $ request ) : RequestInterface { $ now = new \ DateTime ( ) ; if ( $ this -> now instanceof \ DateTime ) { $ now = clone $ this -> now ; } //Generate HTTP headers $ encodedKey = \ rawurlencode ( $ this -> oauthConsumerSecret ) . '&' . \ rawurlencode ( $ this -> oauthAccessTokenSecret ) ; $ oauthParams = [ 'oauth_consumer_key' => $ this -> oauthConsumerKey , 'oauth_token' => $ this -> oauthAccessToken , 'oauth_nonce' => \ sha1 ( \ microtime ( true ) . \ rand ( 10000 , 99999 ) ) , 'oauth_timestamp' => $ now -> getTimestamp ( ) , 'oauth_signature_method' => 'PLAINTEXT' , 'oauth_version' => '1.0' , 'oauth_signature' => $ encodedKey , ] ; $ request = $ request -> withHeader ( 'Authorization' , $ this -> encodeOAuthHeaders ( $ oauthParams ) ) ; return $ request -> withHeader ( 'Expect' , '' ) ; }
Internal method to generate HTTP headers to use for the API authentication with OAuth protocol.

@param RequestInterface $request

@return RequestInterface
Internal method to generate HTTP headers to use for the API authentication with OAuth protocol .