/** * Gets the relevant data from the Guzzle clients. * * @param RequestInterface $request * @param ResponseInterface|PromiseInterface $response */ public function __construct(RequestInterface $request, $response) { if ($response instanceof ResponseInterface) { $this->httpStatusCode = $response->getStatusCode(); } elseif ($response instanceof PromiseInterface) { $this->httpStatusCode = null; } else { throw new \InvalidArgumentException('Second constructor argument "response" must be instance of ResponseInterface or PromiseInterface'); } $this->requestUrl = (string) $request->getUri(); }
/** * Gets the relevant data from the Http client. * * @param TelegramRequest $request * @param ResponseInterface|PromiseInterface $response */ public function __construct(TelegramRequest $request, $response) { if ($response instanceof ResponseInterface) { $this->httpStatusCode = $response->getStatusCode(); $this->body = $response->getBody(); $this->headers = $response->getHeaders(); $this->decodeBody(); } elseif ($response instanceof PromiseInterface) { $this->httpStatusCode = null; } else { throw new \InvalidArgumentException('Second constructor argument "response" must be instance of ResponseInterface or PromiseInterface'); } $this->request = $request; $this->endPoint = (string) $request->getEndpoint(); }