本文整理汇总了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;
}
示例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
}
示例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);
}