scopeConfig->isSetFlag(self::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE); } /** @return int[] */ public function getAllowedCustomerGroupIds(): array { $value = (string)$this->scopeConfig->getValue( self::XML_PATH_ALLOWED_CUSTOMER_GROUPS, ScopeInterface::SCOPE_STORE ); if ($value === '') { return []; } return array_values(array_unique(array_map('intval', array_filter(explode(',', $value), 'strlen')))); } public function isCurrentCustomerAllowed(): bool { $customerGroupId = (int)$this->httpContext->getValue(CustomerContext::CONTEXT_GROUP); return in_array($customerGroupId, $this->getAllowedCustomerGroupIds(), true); } public function isRestricted(): bool { return $this->isEnabled() && !$this->isCurrentCustomerAllowed(); } public function getPopupTitle(): string { return $this->getTextValue(self::XML_PATH_POPUP_TITLE, self::DEFAULT_POPUP_TITLE); } public function getPopupMessage(): string { return $this->getTextValue(self::XML_PATH_POPUP_MESSAGE, self::DEFAULT_POPUP_MESSAGE); } private function getTextValue(string $path, string $default): string { $value = trim((string)$this->scopeConfig->getValue($path, ScopeInterface::SCOPE_STORE)); return $value !== '' ? $value : $default; } }