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

Calculation::getFittingRate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
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