![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-quote/Model/Cart/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Quote\Model\Cart; use Magento\Quote\Api\Data\TotalSegmentInterface; use Magento\Quote\Api\Data\TotalSegmentInterfaceFactory; /** * Cart totals data objects converter. */ class TotalsConverter { /** * @var TotalSegmentInterfaceFactory */ protected $factory; /** * @param TotalSegmentInterfaceFactory $factory */ public function __construct( TotalSegmentInterfaceFactory $factory ) { $this->factory = $factory; } /** * @param \Magento\Quote\Model\Quote\Address\Total[] $addressTotals * @return \Magento\Quote\Api\Data\TotalSegmentInterface[] */ public function process($addressTotals) { $data = []; /** @var \Magento\Quote\Model\Quote\Address\Total $addressTotal */ foreach ($addressTotals as $addressTotal) { $pureData = [ TotalSegmentInterface::CODE => $addressTotal->getCode(), TotalSegmentInterface::TITLE => '', TotalSegmentInterface::VALUE => $addressTotal->getValue(), TotalSegmentInterface::AREA => $addressTotal->getArea(), ]; if (is_object($addressTotal->getTitle())) { $pureData[TotalSegmentInterface::TITLE] = $addressTotal->getTitle()->render(); } /** @var \Magento\Quote\Model\Cart\TotalSegment $total */ $total = $this->factory->create(); $total->setData($pureData); $data[$addressTotal->getCode()] = $total; } return $data; } }