Passed
Push — main ( d8c3bc...d030ca )
by Vasil
03:10
created

CalculationRecipient   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Test Coverage

Coverage 62.5%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 86
ccs 10
cts 16
cp 0.625
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getSiteId() 0 3 1
A __construct() 0 8 1
A getAddressLocation() 0 3 1
A setSiteId() 0 3 1
A setPickupOfficeId() 0 3 1
A getPickupOfficeId() 0 3 1
A isPrivatePerson() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VasilDakov\Speedy\Service\Calculation;
6
7
use VasilDakov\Speedy\ToArray;
8
9
/**
10
 * Class CalculationRecipient
11
 *
12
 * @author Vasil Dakov <[email protected]>
13
 * @copyright 2009-2022 Neutrino.bg
14
 * @version 1.0
15
 */
16
class CalculationRecipient
17
{
18
    use ToArray;
19
20
    /**
21
     * @var bool
22
     */
23
    private bool $privatePerson;
24
25
    /**
26
     * @var CalculationAddressLocation|null
27
     */
28
    private ?CalculationAddressLocation $addressLocation = null;
29
30
    /**
31
     * @var int|null
32
     */
33
    private ?int $siteId = null;
34
35
    /**
36
     * @var int|null
37
     */
38
    private ?int $pickupOfficeId = null;
39
40
    /**
41
     * @param bool $privatePerson
42
     * @param int|null $pickupOfficeId
43
     * @param CalculationAddressLocation|null $addressLocation
44
     */
45 3
    public function __construct(
46
        bool $privatePerson,
47
        ?int $pickupOfficeId = null,
48
        ?CalculationAddressLocation $addressLocation = null
49
    ) {
50 3
        $this->privatePerson   = $privatePerson;
51 3
        $this->pickupOfficeId  = $pickupOfficeId;
52 3
        $this->addressLocation = $addressLocation;
53
    }
54
55
    /**
56
     * @return bool
57
     */
58 1
    public function isPrivatePerson(): bool
59
    {
60 1
        return $this->privatePerson;
61
    }
62
63
64
    /**
65
     * @param int|null $siteId
66
     */
67
    public function setSiteId(?int $siteId): void
68
    {
69
        $this->siteId = $siteId;
70
    }
71
72
    /**
73
     * @return int|null
74
     */
75
    public function getSiteId(): ?int
76
    {
77
        return $this->siteId;
78
    }
79
80
    /**
81
     * @param int|null $pickupOfficeId
82
     */
83
    public function setPickupOfficeId(?int $pickupOfficeId): void
84
    {
85
        $this->pickupOfficeId = $pickupOfficeId;
86
    }
87
88
    /**
89
     * @return int|null
90
     */
91 1
    public function getPickupOfficeId(): ?int
92
    {
93 1
        return $this->pickupOfficeId;
94
    }
95
96
    /**
97
     * @return CalculationAddressLocation|null
98
     */
99 1
    public function getAddressLocation(): ?CalculationAddressLocation
100
    {
101 1
        return $this->addressLocation;
102
    }
103
}
104