authenticate($request), $options ); }; }; } /** * Fetch a guzzle client with the authentication middleware included * * @param mixed[] $options options to pass through to the guzzle client * @return \GuzzleHttp\Client */ public function getClient(array $options = []): \GuzzleHttp\Client { $stack = new \GuzzleHttp\HandlerStack(); $stack->setHandler(new \GuzzleHttp\Handler\CurlHandler()); $stack->push($this->getMiddleware()); return new \GuzzleHttp\Client(array_merge($options, ['handler' => $stack])); } }