config = $config; $this->geotargetingConfig = $geotargetingConfig; $this->geoLocationValidator = $geoLocationValidator; $this->logger = $logger; } /** * @return bool */ public function isApplicable(): bool { if (! $this->config->isModuleEnabled()) { return false; } if (! $this->geotargetingConfig->isEnabled()) { return true; } try { return $this->geoLocationValidator->validateByMergedOptions( $this->geotargetingConfig->getTargetCountries(), $this->geotargetingConfig->getTargetUsStates() ); } catch (LocalizedException $e) { $this->logger->critical($e->getMessage()); return true; } } }