/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
lib/internal/Magento/Framework/Pricing/Price/Factory.php
55 строк
1 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\Price; use Magento\Framework\Pricing\SaleableInterface; /** * Price factory */ class Factory { /** * Object Manager * * @var \Magento\Framework\ObjectManagerInterface */ protected $objectManager; /** * Construct * * @param \Magento\Framework\ObjectManagerInterface $objectManager */ public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager) { $this->objectManager = $objectManager; } /** * Create Price object for particular product * * @param SaleableInterface $saleableItem * @param string $className * @param float $quantity * @param array $arguments * @throws \InvalidArgumentException * @return \Magento\Framework\Pricing\Price\PriceInterface */ public function create(SaleableInterface $saleableItem, $className, $quantity, array $arguments = []) { $arguments['saleableItem'] = $saleableItem; $arguments['quantity'] = $quantity; $price = $this->objectManager->create($className, $arguments); if (!$price instanceof PriceInterface) { throw new \InvalidArgumentException( $className . ' doesn\'t implement \Magento\Framework\Pricing\Price\PriceInterface' ); } return $price; } }