Passed
Push — master ( 4d3a7d...14719f )
by Gabriel
01:41 queued 35s
created

ChangeAddressRequest::getIdentifier()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
ccs 2
cts 2
cp 1
crap 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\AddressChangeContext\UseCases\ChangeAddress;
6
7
use WMDE\FreezableValueObject\FreezableValueObject;
8
use WMDE\Fundraising\AddressChangeContext\Domain\Model\AddressChange;
9
10
class ChangeAddressRequest {
11
	use FreezableValueObject;
12
13
	private string $salutation;
14
15
	private string $company;
16
17
	private string $title;
18
19
	private string $firstName;
20
21
	private string $lastName;
22
23
	private string $address;
24
25
	private string $postcode;
26
27
	private string $city;
28
29
	private string $country;
30
31
	private string $addressType;
32
33
	private string $identifier;
34
35
	private bool $donationReceipt;
36
37
	private bool $isOptOutOnly;
38
39 2
	public function getSalutation(): string {
40 2
		return $this->salutation;
41
	}
42
43 2
	public function setSalutation( string $salutation ): self {
44 2
		$this->assertIsWritable();
45 2
		$this->salutation = trim( $salutation );
46 2
		return $this;
47
	}
48
49 2
	public function getCompany(): string {
50 2
		return $this->company;
51
	}
52
53 2
	public function setCompany( string $company ): self {
54 2
		$this->assertIsWritable();
55 2
		$this->company = trim( $company );
56 2
		return $this;
57
	}
58
59 2
	public function getTitle(): string {
60 2
		return $this->title;
61
	}
62
63 2
	public function setTitle( string $title ): self {
64 2
		$this->assertIsWritable();
65 2
		$this->title = trim( $title );
66 2
		return $this;
67
	}
68
69 2
	public function getFirstName(): string {
70 2
		return $this->firstName;
71
	}
72
73 2
	public function setFirstName( string $firstName ): self {
74 2
		$this->assertIsWritable();
75 2
		$this->firstName = trim( $firstName );
76 2
		return $this;
77
	}
78
79 2
	public function getLastName(): string {
80 2
		return $this->lastName;
81
	}
82
83 2
	public function setLastName( string $lastName ): self {
84 2
		$this->assertIsWritable();
85 2
		$this->lastName = trim( $lastName );
86 2
		return $this;
87
	}
88
89 2
	public function getAddress(): string {
90 2
		return $this->address;
91
	}
92
93 2
	public function setAddress( string $address ): self {
94 2
		$this->assertIsWritable();
95 2
		$this->address = trim( $address );
96 2
		return $this;
97
	}
98
99 2
	public function getPostcode(): string {
100 2
		return $this->postcode;
101
	}
102
103 2
	public function setPostcode( string $postcode ): self {
104 2
		$this->assertIsWritable();
105 2
		$this->postcode = trim( $postcode );
106 2
		return $this;
107
	}
108
109 2
	public function getCity(): string {
110 2
		return $this->city;
111
	}
112
113 2
	public function setCity( string $city ): self {
114 2
		$this->assertIsWritable();
115 2
		$this->city = trim( $city );
116 2
		return $this;
117
	}
118
119 2
	public function getCountry(): string {
120 2
		return $this->country;
121
	}
122
123 2
	public function setCountry( string $country ): self {
124 2
		$this->assertIsWritable();
125 2
		$this->country = trim( $country );
126 2
		return $this;
127
	}
128
129 1
	public function getAddressType(): string {
130 1
		return $this->addressType;
131
	}
132
133 1
	public function isPersonal(): bool {
134 1
		return $this->addressType === AddressChange::ADDRESS_TYPE_PERSON;
135
	}
136
137 1
	public function isCompany(): bool {
138 1
		return $this->addressType === AddressChange::ADDRESS_TYPE_COMPANY;
139
	}
140
141 1
	public function setAddressType( string $addressType ): self {
142 1
		$this->assertIsWritable();
143 1
		$this->addressType = $addressType;
144 1
		return $this;
145
	}
146
147 2
	public function getIdentifier(): string {
148 2
		return $this->identifier;
149
	}
150
151 2
	public function setIdentifier( string $identifier ): self {
152 2
		$this->assertIsWritable();
153 2
		$this->identifier = trim( $identifier );
154 2
		return $this;
155
	}
156
157 1
	public function isOptedOutOfDonationReceipt(): bool {
158 1
		return !$this->donationReceipt;
159
	}
160
161 1
	public function setDonationReceipt( bool $donationReceipt ): self {
162 1
		$this->assertIsWritable();
163 1
		$this->donationReceipt = $donationReceipt;
164 1
		return $this;
165
	}
166
167 1
	public function setIsOptOutOnly( bool $isOptOutOnly ): self {
168 1
		$this->assertIsWritable();
169 1
		$this->isOptOutOnly = $isOptOutOnly;
170 1
		return $this;
171
	}
172
173 1
	public function hasAddressChangeData(): bool {
174 1
		return !$this->isOptOutOnly;
175
	}
176
177
}
178