/** * @param string $path * @return string */ public function getFrontendWebsiteOrBackendValue($path) { $value = ''; if ($this->appStateHelper->isFrontendArea()) { $value = $this->getWebsiteValue($path); } else { if ($this->scopeDefiner->getScope() != ScopeInterface::SCOPE_STORE) { $value = $this->appScopeConfig->getValue($path, $this->scopeDefiner->getScope(), $this->scopeDefiner->getScopeValue()); } } return $value; }
/** * @return bool */ public function isAvailable() { return $this->appStateHelper->isFrontendArea() && !$this->requestHelper->isCurrentIp($this->getWhiteIps()) && !$this->requestHelper->isCurrentUserAgent($this->getWhiteUa()) && $this->isActive(); }
public function testIsFrontendAreaException() { $this->state->expects($this->atLeastOnce())->method('getAreaCode')->willThrowException(new LocalizedException(__('error'))); $this->assertFalse($this->appState->isFrontendArea()); }