Calculation::getNoticePaymentMethod()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
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\Entities\DeliveryTime;
20
use Appwilio\RussianPostSDK\Dispatching\Enum\PaymentMethodType;
21
22
final class Calculation
23
{
24
    use DataAware;
25
26 1
    public function getPaymentMethod(): PaymentMethodType
27
    {
28 1
        return new PaymentMethodType($this->get('payment-method'));
29
    }
30
31 1
    public function getNoticePaymentMethod(): PaymentMethodType
32
    {
33 1
        return new PaymentMethodType($this->get('notice-payment-method'));
34
    }
35
36 1
    public function getDeliveryTime(): ?DeliveryTime
37
    {
38 1
        return Instantiator::instantiate(DeliveryTime::class, $this->get('delivery-time'));
39
    }
40
41 1
    public function getFittingRate(): ?Tariff
42
    {
43 1
        return Instantiator::instantiate(Tariff::class, $this->get('with-fitting-rate'));
44
    }
45
46 1
    public function getSmsNoticeRate(): ?Tariff
47
    {
48 1
        return Instantiator::instantiate(Tariff::class, $this->get('sms-notice-recipient-rate'));
49
    }
50
51 1
    public function getNoticeRate(): ?Tariff
52
    {
53 1
        return Instantiator::instantiate(Tariff::class, $this->get('notice-rate'));
54
    }
55
56 1
    public function getCompletenessCheckingRate(): ?Tariff
57
    {
58 1
        return Instantiator::instantiate(Tariff::class, $this->get('completeness-checking-rate'));
59
    }
60
61 1
    public function getContentCheckingRate(): ?Tariff
62
    {
63 1
        return Instantiator::instantiate(Tariff::class, $this->get('contents-checking-rate'));
64
    }
65
66 1
    public function getOversizeRate(): ?Tariff
67
    {
68 1
        return Instantiator::instantiate(Tariff::class, $this->get('oversize-rate'));
69
    }
70
71 1
    public function getInsuranceRate(): ?Tariff
72
    {
73 1
        return Instantiator::instantiate(Tariff::class, $this->get('insurance-rate'));
74
    }
75
76 1
    public function getInventoryRate(): ?Tariff
77
    {
78 1
        return Instantiator::instantiate(Tariff::class, $this->get('inventory-rate'));
79
    }
80
81 1
    public function getAviaRate(): ?Tariff
82
    {
83 1
        return Instantiator::instantiate(Tariff::class, $this->get('avia-rate'));
84
    }
85
86 1
    public function getGroundRate(): ?Tariff
87
    {
88 1
        return Instantiator::instantiate(Tariff::class, $this->get('ground-rate'));
89
    }
90
91 1
    public function getFragileRate(): ?Tariff
92
    {
93 1
        return Instantiator::instantiate(Tariff::class, $this->get('fragile-rate'));
94
    }
95
96 1
    public function getVsdRate(): ?Tariff
97
    {
98 1
        return Instantiator::instantiate(Tariff::class, $this->get('vsd-rate'));
99
    }
100
101 2
    public function getTotalRate(): Tariff
102
    {
103 2
        return Instantiator::instantiate(Tariff::class, [
104 2
            'rate' => $this->get('total-rate'),
105 2
            'vat' => $this->get('total-vat'),
106
        ]);
107
    }
108
}
109