/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
lib/internal/Magento/Framework/Pricing/Amount/AmountFactory.php
63 строки
2 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 17:47
22 окт 2025, 17:47
1b769b7
Код
Авторство
О чём код?
<?php /** * Copyright 2014 Adobe * All Rights Reserved. */ namespace Magento\Framework\Pricing\Amount; /** * Class AmountFactory * * @api * @since 100.0.2 */ class AmountFactory { /** * Default amount class */ const DEFAULT_PRICE_AMOUNT_CLASS = \Magento\Framework\Pricing\Amount\AmountInterface::class; /** * @var \Magento\Framework\ObjectManagerInterface */ protected $objectManager; /** * Constructor * * @param \Magento\Framework\ObjectManagerInterface $objectManager */ public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager) { $this->objectManager = $objectManager; } /** * Create Amount object * * @param float $amount * @param array $adjustmentAmounts * @return \Magento\Framework\Pricing\Amount\AmountInterface * @throws \InvalidArgumentException */ public function create($amount, array $adjustmentAmounts = []) { $amountModel = $this->objectManager->create( self::DEFAULT_PRICE_AMOUNT_CLASS, [ 'amount' => $amount, 'adjustmentAmounts' => $adjustmentAmounts ] ); if (!$amountModel instanceof \Magento\Framework\Pricing\Amount\AmountInterface) { throw new \InvalidArgumentException( get_class($amountModel) . ' doesn\'t implement \Magento\Framework\Pricing\Amount\AmountInterface' ); } return $amountModel; } }