cache->get($cacheKey, function (ItemInterface $item) use ($api, $method): array { $item->expiresAfter(3600); $item->tag([$api, $method]); $client = $this->getClient()->getApi($api); $value = \call_user_func_array([$client, $method], $arguments); return $value; }); } public function getClient(): ?Psr18Client { if (!$this->client) { $guzzle = new GuzzleClient(); $factory = new GuzzleHttpFactory(); $this->client = new Psr18Client( $guzzle, $factory, $factory, $this->url, $this->apiKey ); } return $this->client; } }