/** * @param Result $result * @param StoreInterface $store * @param string $baseUrl setting */ protected function checkSettings(Result $result, StoreInterface $store, $baseUrl) { $errorMessage = 'Wrong hostname configured. <info>Hostname must contain a dot</info>'; $host = parse_url($baseUrl, PHP_URL_HOST); $isValid = (bool) strstr($host, '.'); $result->setStatus($isValid); if ($isValid) { $result->setMessage('<info>' . ucfirst($this->class) . ' BaseURL: <comment>' . $baseUrl . '</comment> of Store: <comment>' . $store->getCode() . '</comment> - OK'); } else { $result->setMessage('<error>Invalid ' . ucfirst($this->class) . ' BaseURL: <comment>' . $baseUrl . '</comment> of Store: <comment>' . $store->getCode() . '</comment> ' . $errorMessage . '</error>'); } }
/** * @param Result $result * @param StoreInterface $store * @param string $baseUrl setting * @param string $cookieDomain setting */ protected function checkSettings(Result $result, StoreInterface $store, $baseUrl, $cookieDomain) { $errorMessage = 'cookie-domain and ' . $this->class . ' base-URL do not match'; if (strlen($cookieDomain)) { $isValid = $this->validateCookieDomainAgainstUrl($cookieDomain, $baseUrl); $result->setStatus($isValid); if ($isValid) { $result->setMessage('<info>Cookie Domain (' . $this->class . '): <comment>' . $cookieDomain . '</comment>' . ' of Store: <comment>' . $store->getCode() . '</comment> - OK</info>'); } else { $result->setMessage('<error>Cookie Domain (' . $this->class . '): <comment>' . $cookieDomain . '</comment>' . ' of Store: <comment>' . $store->getCode() . '</comment> - ERROR: ' . $errorMessage . '</error>'); } } else { $result->setMessage('<info>Empty cookie Domain (' . $this->class . ') of Store: <comment>' . $store->getCode() . '</comment> - OK</info>'); } }
/** * @param StoreInterface $store * @param array $typedParams * @return array */ private function getParamValues(StoreInterface $store, array $typedParams) { $paramValues = $this->storeConfigPaths; foreach ($paramValues as $name => $path) { $value = $this->scopeConfig->getValue(ScopeInterface::SCOPE_STORE, $store->getCode()); $paramValues[$name] = $value; } $paramValues = $typedParams + $paramValues; return $paramValues; }
/** * {@inheritdoc} */ public function setStoreCookie(StoreInterface $store) { $cookieMetadata = $this->cookieMetadataFactory->createPublicCookieMetadata()->setHttpOnly(true)->setDurationOneYear()->setPath($store->getStorePath()); $this->cookieManager->setPublicCookie(self::COOKIE_NAME, $store->getCode(), $cookieMetadata); }
/** * @param StoreInterface $store * @return string */ private function getFrontendStoreUrl(StoreInterface $store) { return $store->getBaseUrl(FrontendUrlInterface::URL_TYPE_LINK) . '?___store=' . $store->getCode(); }