configUtils = $configUtils; } /** * @param $store * @param $scope * @return bool */ public function isEnabled($store = null, $scope = null): bool { return ! in_array(LocationsListInterface::ALL, $this->getTargetCountries($store, $scope), true); } /** * @param $store * @param $scope * @return array */ public function getTargetCountries($store = null, $scope = null): array { $targetingConfig = (string) $this->configUtils->getConfig(self::XML_PATH_TARGET_COUNTRIES, $store, $scope); return $this->configUtils->prepareMultiselectValue($targetingConfig); } /** * @param $store * @param $scope * @return array */ public function getTargetUsStates($store = null, $scope = null): array { if (! in_array(LocationsListInterface::COUNTRY_CODE_USA, $this->getTargetCountries($store, $scope), true)) { return []; } $targetingConfig = $this->configUtils->prepareMultiselectValue( (string) $this->configUtils->getConfig(self::XML_PATH_TARGET_US_STATES, $store, $scope) ); if (in_array(LocationsListInterface::ALL, $targetingConfig, true)) { return []; } return $targetingConfig; } }