Passed
Push — master ( 65a6b4...cbdbb3 )
by Jhao
02:03
created

Calculation::getGroundRate()   A

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