當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Repository::createAsset方法代碼示例

本文整理匯總了PHP中Repository::createAsset方法的典型用法代碼示例。如果您正苦於以下問題:PHP Repository::createAsset方法的具體用法?PHP Repository::createAsset怎麽用?PHP Repository::createAsset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Repository的用法示例。


在下文中一共展示了Repository::createAsset方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _fetchHppMethods

 /**
  * @param $store
  * @param $country
  * @return array
  */
 protected function _fetchHppMethods($store, $country)
 {
     $skinCode = $this->_adyenHelper->getAdyenHppConfigData('skin_code');
     $merchantAccount = $this->_adyenHelper->getAdyenAbstractConfigData('merchant_account');
     if (!$skinCode || !$merchantAccount) {
         return [];
     }
     $adyFields = ["paymentAmount" => (int) $this->_adyenHelper->formatAmount($this->_getCurrentPaymentAmount(), $this->_getCurrentCurrencyCode($store)), "currencyCode" => $this->_getCurrentCurrencyCode($store), "merchantReference" => "Get Payment methods", "skinCode" => $skinCode, "merchantAccount" => $merchantAccount, "sessionValidity" => date(DATE_ATOM, mktime(date("H") + 1, date("i"), date("s"), date("m"), date("j"), date("Y"))), "countryCode" => $this->_getCurrentCountryCode($store, $country), "shopperLocale" => $this->_getCurrentLocaleCode($store)];
     $responseData = $this->_getDirectoryLookupResponse($adyFields, $store);
     $paymentMethods = [];
     if (isset($responseData['paymentMethods'])) {
         foreach ($responseData['paymentMethods'] as $paymentMethod) {
             $paymentMethodCode = $paymentMethod['brandCode'];
             $paymentMethod = $this->_fieldMapPaymentMethod($paymentMethod);
             // check if payment method is an openinvoice method
             $paymentMethod['isPaymentMethodOpenInvoiceMethod'] = $this->_adyenHelper->isPaymentMethodOpenInvoiceMethod($paymentMethodCode);
             // add icon location in result
             if ($this->_adyenHelper->showLogos()) {
                 $params = [];
                 // use frontend area
                 $params = array_merge(['area' => 'frontend', '_secure' => $this->_request->isSecure()], $params);
                 $asset = $this->_assetRepo->createAsset('Adyen_Payment::images/logos/' . $paymentMethodCode . '.png', $params);
                 $placeholder = $this->_assetSource->findSource($asset);
                 $icon = null;
                 if ($placeholder) {
                     list($width, $height) = getimagesize($asset->getSourceFile());
                     $icon = ['url' => $asset->getUrl(), 'width' => $width, 'height' => $height];
                 }
                 $paymentMethod['icon'] = $icon;
             }
             $paymentMethods[$paymentMethodCode] = $paymentMethod;
         }
     }
     return $paymentMethods;
 }
開發者ID:Adyen,項目名稱:adyen-magento2,代碼行數:40,代碼來源:PaymentMethods.php

示例2: testGetStaticViewFileContext

 public function testGetStaticViewFileContext()
 {
     $this->mockDesign();
     $context = $this->object->getStaticViewFileContext();
     $this->assertInstanceOf('\\Magento\\Framework\\View\\Asset\\ContextInterface', $context);
     $this->assertSame($context, $this->object->getStaticViewFileContext());
     // to ensure in-memory caching
     $asset = $this->object->createAsset('test/file.js');
     $this->assertSame($context, $asset->getContext());
     // and once again to ensure in-memory caching for real
 }
開發者ID:buskamuza,項目名稱:magento2-skeleton,代碼行數:11,代碼來源:RepositoryTest.php

示例3: createAsset

 /**
  * Create a file asset that's subject of fallback system
  *
  * @param string $fileId
  * @param array $params
  * @return \Magento\Framework\View\Asset\File
  */
 public function createAsset($fileId, array $params = [])
 {
     $params = array_merge(['_secure' => $this->_request->isSecure()], $params);
     return $this->_assetRepo->createAsset($fileId, $params);
 }
開發者ID:Adyen,項目名稱:adyen-magento2,代碼行數:12,代碼來源:Data.php


注:本文中的Repository::createAsset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。