Passed
Push — main ( 8bdffa...c425e9 )
by Vasil
04:29
created

CalculationRecipient   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 81
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 81
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 3
    public function __construct(
41
        bool $privatePerson,
42
        ?int $pickupOfficeId = null,
43
        ?CalculationAddressLocation $addressLocation = null
44
    ) {
45 3
        $this->privatePerson   = $privatePerson;
46 3
        $this->pickupOfficeId  = $pickupOfficeId;
47 3
        $this->addressLocation = $addressLocation;
48
    }
49
50
    /**
51
     * @return bool
52
     */
53 1
    public function isPrivatePerson(): bool
54
    {
55 1
        return $this->privatePerson;
56
    }
57
58
59
    /**
60
     * @param int|null $siteId
61
     */
62
    public function setSiteId(?int $siteId): void
63
    {
64
        $this->siteId = $siteId;
65
    }
66
67
    /**
68
     * @return int|null
69
     */
70
    public function getSiteId(): ?int
71
    {
72
        return $this->siteId;
73
    }
74
75
    /**
76
     * @param int|null $pickupOfficeId
77
     */
78
    public function setPickupOfficeId(?int $pickupOfficeId): void
79
    {
80
        $this->pickupOfficeId = $pickupOfficeId;
81
    }
82
83
    /**
84
     * @return int|null
85
     */
86 1
    public function getPickupOfficeId(): ?int
87
    {
88 1
        return $this->pickupOfficeId;
89
    }
90
91
    /**
92
     * @return CalculationAddressLocation|null
93
     */
94 1
    public function getAddressLocation(): ?CalculationAddressLocation
95
    {
96 1
        return $this->addressLocation;
97
    }
98
}
99