Passed
Push — master ( 6bd912...2e1381 )
by Jhao
03:15
created

Calculation   A

Complexity

Total Complexity 16

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 84
ccs 0
cts 65
cp 0
rs 10
c 0
b 0
f 0
wmc 16

16 Methods

Rating   Name   Duplication   Size   Complexity  
A getDeliveryTime() 0 3 1
A getPaymentMethod() 0 3 1
A getNoticePaymentMethod() 0 3 1
A getFittingRate() 0 3 1
A getVsdRate() 0 3 1
A getTotalRate() 0 5 1
A getAviaRate() 0 3 1
A getInventoryRate() 0 3 1
A getGroundRate() 0 3 1
A getFragileRate() 0 3 1
A getOversizeRate() 0 3 1
A getContentCheckingRate() 0 3 1
A getCompletenessCheckingRate() 0 3 1
A getSmsNoticeRate() 0 3 1
A getNoticeRate() 0 3 1
A getInsuranceRate() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of RussianPost SDK package.
5
 *
6
 * © Appwilio (http://appwilio.com), JhaoDa (https://github.com/jhaoda)
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Appwilio\RussianPostSDK\Dispatching\Endpoints\Services\Entities;
15
16
use Appwilio\RussianPostSDK\Dispatching\DataAware;
17
use Appwilio\RussianPostSDK\Dispatching\Instantiator;
18
use Appwilio\RussianPostSDK\Dispatching\Entities\Tariff;
19
use Appwilio\RussianPostSDK\Dispatching\Contracts\Arrayable;
20
use Appwilio\RussianPostSDK\Dispatching\Entities\DeliveryTime;
21
22
final class Calculation implements Arrayable
23
{
24
    use DataAware;
25
26
    public function getPaymentMethod(): string
27
    {
28
        return $this->get('payment-method');
29
    }
30
31
    public function getNoticePaymentMethod(): string
32
    {
33
        return $this->get('notice-payment-method');
34
    }
35
36
    public function getDeliveryTime(): ?DeliveryTime
37
    {
38
        return Instantiator::instantiate(DeliveryTime::class, $this->get('delivery-time'));
39
    }
40
41
    public function getFittingRate(): ?Tariff
42
    {
43
        return Instantiator::instantiate(Tariff::class, $this->get('with-fitting-rate'));
44
    }
45
46
    public function getSmsNoticeRate(): ?Tariff
47
    {
48
        return Instantiator::instantiate(Tariff::class, $this->get('sms-notice-recipient-rate'));
49
    }
50
51
    public function getNoticeRate(): ?Tariff
52
    {
53
        return Instantiator::instantiate(Tariff::class, $this->get('notice-rate'));
54
    }
55
56
    public function getCompletenessCheckingRate(): ?Tariff
57
    {
58
        return Instantiator::instantiate(Tariff::class, $this->get('completeness-checking-rate'));
59
    }
60
61
    public function getContentCheckingRate(): ?Tariff
62
    {
63
        return Instantiator::instantiate(Tariff::class, $this->get('contents-checking-rate'));
64
    }
65
66
    public function getOversizeRate(): ?Tariff
67
    {
68
        return Instantiator::instantiate(Tariff::class, $this->get('oversize-rate'));
69
    }
70
71
    public function getInsuranceRate(): ?Tariff
72
    {
73
        return Instantiator::instantiate(Tariff::class, $this->get('insurance-rate'));
74
    }
75
76
    public function getInventoryRate(): ?Tariff
77
    {
78
        return Instantiator::instantiate(Tariff::class, $this->get('inventory-rate'));
79
    }
80
81
    public function getAviaRate(): ?Tariff
82
    {
83
        return Instantiator::instantiate(Tariff::class, $this->get('avia-rate'));
84
    }
85
86
    public function getGroundRate(): ?Tariff
87
    {
88
        return Instantiator::instantiate(Tariff::class, $this->get('ground-rate'));
89
    }
90
91
    public function getFragileRate(): ?Tariff
92
    {
93
        return Instantiator::instantiate(Tariff::class, $this->get('fragile-rate'));
94
    }
95
96
    public function getVsdRate(): ?Tariff
97
    {
98
        return Instantiator::instantiate(Tariff::class, $this->get('vsd-rate'));
99
    }
100
101
    public function getTotalRate(): Tariff
102
    {
103
        return Instantiator::instantiate(Tariff::class, [
104
            'rate' => $this->get('total-rate'),
105
            'vat' => $this->get('total-vat'),
106
        ]);
107
    }
108
}
109