Completed
Push — master ( 41948a...5bb6bb )
by Łukasz
17:08 queued 13:33
created

TotalViewFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
3
namespace Sylius\ShopApiPlugin\Factory;
4
5
use Sylius\Component\Core\Model\OrderInterface;
6
use Sylius\ShopApiPlugin\View\TotalsView;
7
8
final class TotalViewFactory implements TotalViewFactoryInterface
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function create(OrderInterface $cart)
14
    {
15
        $totalsView = new TotalsView();
16
17
        $totalsView->promotion = $cart->getOrderPromotionTotal();
18
        $totalsView->items = $cart->getItemsTotal();
19
        $totalsView->shipping = $cart->getShippingTotal();
20
        $totalsView->taxes = $cart->getTaxTotal();
21
22
        return $totalsView;
23
    }
24
}
25