Completed
Push — master ( a0d538...0ed0ec )
by Adam
07:36
created

OrderContext::getSubject()   A

Complexity

Conditions 1
Paths 1

Duplication

Lines 0
Ratio 0 %

Size

Total Lines 4
Code Lines 2

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/*
3
 * WellCommerce Open-Source E-Commerce Platform
4
 * 
5
 * This file is part of the WellCommerce package.
6
 *
7
 * (c) Adam Piotrowski <[email protected]>
8
 * 
9
 * For the full copyright and license information,
10
 * please view the LICENSE file that was distributed with this source code.
11
 */
12
13
namespace WellCommerce\Bundle\OrderBundle\Context;
14
15
use WellCommerce\Bundle\AppBundle\Entity\Shop;
16
use WellCommerce\Bundle\OrderBundle\Calculator\ShippingSubjectInterface;
17
use WellCommerce\Bundle\OrderBundle\Entity\Order;
18
19
/**
20
 * Class OrderAdapter
21
 *
22
 * @author  Adam Piotrowski <[email protected]>
23
 */
24
final class OrderContext implements ShippingSubjectInterface
25
{
26
    /**
27
     * @var Order
28
     */
29
    protected $order;
30
    
31
    public function __construct(Order $order)
32
    {
33
        $this->order = $order;
34
    }
35
    
36
    public function getQuantity(): int
37
    {
38
        return $this->order->getProductTotal()->getQuantity();
39
    }
40
    
41
    public function getWeight(): float
42
    {
43
        return $this->order->getProductTotal()->getWeight();
44
    }
45
    
46
    public function getGrossPrice(): float
47
    {
48
        return $this->order->getProductTotal()->getGrossPrice();
49
    }
50
    
51
    public function getNetPrice(): float
52
    {
53
        return $this->order->getProductTotal()->getNetPrice();
54
    }
55
    
56
    public function getTaxAmount(): float
57
    {
58
        return $this->order->getProductTotal()->getTaxAmount();
59
    }
60
    
61
    public function getCurrency(): string
62
    {
63
        return $this->order->getCurrency();
64
    }
65
    
66
    public function getCountry(): string
67
    {
68
        return $this->order->getShippingAddress()->getCountry();
69
    }
70
    
71
    public function getShop()
72
    {
73
        return $this->order->getShop();
74
    }
75
    
76
    public function getSubject()
77
    {
78
        return $this->order;
79
    }
80
}
81