getCachedTldList(); if (!$item->isHit()) { $supportedTldList = $this->getSupportedTldList(); $item ->set($supportedTldList) ->expiresAfter(new \DateInterval('P1D')); $this->cacheItemPool->saveDeferred($item); } else { $supportedTldList = $item->get(); } /** @var string $tldString */ foreach (array_unique(array_map(fn (Tld $tld) => $tld->getTld(), $tldList)) as $tldString) { if (!in_array($tldString, $supportedTldList)) { return false; } } return true; } abstract protected function getCachedTldList(): CacheItemInterface; abstract protected function getSupportedTldList(): array; }