ShipmentPayment   A
last analyzed

Complexity

Total Complexity 14

Size/Duplication

Total Lines 122
Duplicated Lines 0 %

Test Coverage

Coverage 65.71%

Importance

Changes 0
Metric Value
eloc 29
dl 0
loc 122
ccs 23
cts 35
cp 0.6571
rs 10
c 0
b 0
f 0
wmc 14

14 Methods

Rating   Name   Duplication   Size   Complexity  
A getSenderBankAccount() 0 3 1
A setDeclaredValuePayer() 0 3 1
A setDiscountCardId() 0 5 1
A setThirdPartyClientId() 0 5 1
A setSenderBankAccount() 0 5 1
A __construct() 0 4 1
A getDiscountCardId() 0 3 1
A getThirdPartyClientId() 0 3 1
A setPackagePayer() 0 5 1
A getPackagePayer() 0 3 1
A toArray() 0 5 1
A getDeclaredValuePayer() 0 3 1
A setCourierServicePayer() 0 3 1
A getCourierServicePayer() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VasilDakov\Speedy\Service\Shipment;
6
7
use JMS\Serializer\Annotation as Serializer;
8
use VasilDakov\Speedy\Model\BankAccount;
9
use VasilDakov\Speedy\Property;
10
use VasilDakov\Speedy\Speedy;
11
use VasilDakov\Speedy\Traits\ToArray;
12
13
/**
14
 * Class ShipmentPayment.
15
 *
16
 * @author Valentin Valkanov <[email protected]>
17
 * @author Vasil Dakov <[email protected]>
18
 * @copyright
19
 *
20
 * @version
21
 *
22
 * @Serializer\AccessType("public_method")
23
 */
24
class ShipmentPayment
25
{
26
    use ToArray;
0 ignored issues
show
Bug introduced by
The trait VasilDakov\Speedy\Traits\ToArray requires the property $value which is not provided by VasilDakov\Speedy\Service\Shipment\ShipmentPayment.
Loading history...
27
28
    /**
29
     * @Serializer\Type("string")
30
     */
31
    private string $courierServicePayer;
32
33
    /**
34
     * @Serializer\Type("string")
35
     */
36
    private ?string $declaredValuePayer = '';
37
38
    /**
39
     * @Serializer\Type("string")
40
     */
41
    private ?string $packagePayer = '';
42
43
    /**
44
     * @Serializer\Type("integer")
45
     */
46
    private ?int $thirdPartyClientId = null;
47
48
    /**
49
     * @Serializer\Type("VasilDakov\Speedy\Service\Shipment\ShipmentDiscountCardId")
50
     */
51
    private ?ShipmentDiscountCardId $discountCardId = null;
52
53
    /**
54
     * @Serializer\Type("VasilDakov\Speedy\Model\BankAccount")
55
     */
56
    private ?BankAccount $senderBankAccount = null;
57
58 2
    public function __construct(string $courierServicePayer, string $declaredValuePayer)
59
    {
60 2
        $this->courierServicePayer = $courierServicePayer;
61 2
        $this->declaredValuePayer = $declaredValuePayer;
62
    }
63
64 2
    public function setCourierServicePayer(string $courierServicePayer): void
65
    {
66 2
        $this->courierServicePayer = $courierServicePayer;
67
    }
68
69
    public function getCourierServicePayer(): string
70
    {
71
        return $this->courierServicePayer;
72
    }
73
74 1
    public function setDeclaredValuePayer(string $declaredValuePayer): void
75
    {
76 1
        $this->declaredValuePayer = $declaredValuePayer;
77
    }
78
79
    public function getDeclaredValuePayer(): ?string
80
    {
81
        return $this->declaredValuePayer;
82
    }
83
84
    /**
85
     * @return $this
86
     */
87 1
    public function setPackagePayer(string $packagePayer): self
88
    {
89 1
        $this->packagePayer = $packagePayer;
90
91 1
        return $this;
92
    }
93
94
    public function getPackagePayer(): ?string
95
    {
96
        return $this->packagePayer;
97
    }
98
99
    /**
100
     * @return $this
101
     */
102 1
    public function setThirdPartyClientId(?int $thirdPartyClientId): self
103
    {
104 1
        $this->thirdPartyClientId = $thirdPartyClientId;
105
106 1
        return $this;
107
    }
108
109
    public function getThirdPartyClientId(): ?int
110
    {
111
        return $this->thirdPartyClientId;
112
    }
113
114 1
    public function setDiscountCardId(ShipmentDiscountCardId $discountCardId = null): self
115
    {
116 1
        $this->discountCardId = $discountCardId;
117
118 1
        return $this;
119
    }
120
121
    public function getDiscountCardId(): ?ShipmentDiscountCardId
122
    {
123
        return $this->discountCardId;
124
    }
125
126
    /**
127
     * @return $this
128
     */
129 1
    public function setSenderBankAccount(BankAccount $bankAccount = null): self
130
    {
131 1
        $this->senderBankAccount = $bankAccount;
132
133 1
        return $this;
134
    }
135
136
    public function getSenderBankAccount(): ?BankAccount
137
    {
138
        return $this->senderBankAccount;
139
    }
140
141 3
    public function toArray(): array
142
    {
143 3
        return [
144 3
            Property::COURIER_SERVICE_PAYER->value => $this->courierServicePayer,
145 3
            Property::DECLARED_VALUE_PAYER->value => $this->declaredValuePayer,
146 3
        ];
147
    }
148
}
149