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

TotalViewFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 11 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