コード例 #1
0
ファイル: Builder.php プロジェクト: Nosto/nosto-magento2
 /**
  * @param Store $store
  * @return \NostoAccount
  */
 public function build(Store $store)
 {
     $metaData = new \NostoAccount();
     try {
         $metaData->setTitle(implode(' - ', [$store->getWebsite()->getName(), $store->getGroup()->getName(), $store->getName()]));
         $metaData->setName(substr(sha1(rand()), 0, 8));
         $metaData->setFrontPageUrl(\NostoHttpRequest::replaceQueryParamInUrl('___store', $store->getCode(), $store->getBaseUrl(UrlInterface::URL_TYPE_WEB)));
         $metaData->setCurrency(new \NostoCurrencyCode($store->getBaseCurrencyCode()));
         $lang = substr($store->getConfig('general/locale/code'), 0, 2);
         $metaData->setLanguage(new \NostoLanguageCode($lang));
         $lang = substr($this->_localeResolver->getLocale(), 0, 2);
         $metaData->setOwnerLanguage(new \NostoLanguageCode($lang));
         $owner = $this->_accountOwnerMetaBuilder->build();
         $metaData->setOwner($owner);
         $billing = $this->_accountBillingMetaBuilder->build($store);
         $metaData->setBilling($billing);
     } catch (\NostoException $e) {
         $this->_logger->error($e, ['exception' => $e]);
     }
     return $metaData;
 }