public function createRequest(string $method, string $uri, array $body = []): RequestInterface
    {
        $request = $this->requestFactory->createRequest($method, $uri)
            ->withHeader('Content-Type', 'application/json')
            ->withHeader('Authorization', 'Token ' . $this->token)
            ->withHeader('X-Secret', $this->secret)
        ;

        if (!empty($body)) {
            $request = $request
                ->withBody($this->streamFactory->createStream(json_encode($body, JSON_UNESCAPED_UNICODE)))
            ;
        }

        return $request;
    }
public function createRequest(string $method, string $uri, array $body = []): RequestInterface
    {
        $request = $this->requestFactory->createRequest($method, $uri)
            ->withHeader('Content-Type', 'application/json')
            ->withHeader('Authorization', 'Token ' . $this->token)
            ->withHeader('X-Secret', $this->secret)
        ;

        if (!empty($body)) {
            $request = $request
                ->withBody($this->streamFactory->createStream(json_encode($body, JSON_UNESCAPED_UNICODE)))
            ;
        }

        return $request;
    }
public function createRequest ( string $ method , string $ uri , array $ body = [ ] ) : RequestInterface { $ request = $ this -> requestFactory -> createRequest ( $ method , $ uri ) -> withHeader ( 'Content-Type' , 'application/json' ) -> withHeader ( 'Authorization' , 'Token ' . $ this -> token ) -> withHeader ( 'X-Secret' , $ this -> secret ) ; if ( ! empty ( $ body ) ) { $ request = $ request -> withBody ( $ this -> streamFactory -> createStream ( json_encode ( $ body , JSON_UNESCAPED_UNICODE ) ) ) ; } return $ request ; }
Creates request with necessary headers & encoded body.

@param string $method
@param string $uri
@param array $body

@return RequestInterface
Creates request with necessary headers & encoded body .