Completed
Pull Request — master (#105)
by Gabriel
03:08
created

Subscription::setCampaignCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
namespace WMDE\Fundraising\Entities;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Gedmo\Mapping\Annotation as Gedmo;
7
8
/**
9
 * @since 2.0
10
 *
11
 * @ORM\Table( name="subscription" )
12
 * @ORM\Entity
13
 */
14
class Subscription {
15
16
	/**
17
	 * @var string
18
	 *
19
	 * @ORM\Column(name="full_name", type="string", length=250, options={"default":""}, nullable=false)
20
	 */
21
	private $fullName = '';
22
23
	/**
24
	 * @var string
25
	 *
26
	 * @ORM\Column(name="email", type="string", length=250, options={"default":""}, nullable=false)
27
	 */
28
	private $email = '';
29
30
	/**
31
	 * @var \DateTime
32
	 *
33
	 * @ORM\Column(name="export", type="datetime", nullable=true)
34
	 */
35
	private $export;
36
37
	/**
38
	 * @var \DateTime
39
	 *
40
	 * @ORM\Column(name="backup", type="datetime", nullable=true)
41
	 */
42
	private $backup;
43
44
	/**
45
	 * @var integer
46
	 *
47
	 * @ORM\Column(name="status", type="smallint", options={"default":0}, nullable=true)
48
	 */
49
	private $status = 0;
50
51
	/**
52
	 * @var string
53
	 *
54
	 * @ORM\Column(name="confirmationCode", type="blob", length=16, nullable=true)
55
	 */
56
	private $confirmationCode;
57
58
	/**
59
	 * @var integer
60
	 *
61
	 * @ORM\Column(name="id", type="integer")
62
	 * @ORM\Id
63
	 * @ORM\GeneratedValue(strategy="IDENTITY")
64
	 */
65
	private $id;
66
67
	/**
68
	 * @ORM\ManyToOne(targetEntity="Address")
69
	 * @ORM\JoinColumn(name="address_id", referencedColumnName="id")
70
	 */
71
	private $address;
72
73
	/**
74
	 * @var string
75
	 *
76
	 * @ORM\Column(name="tracking", type="string", length=50, nullable=true)
77
	 */
78
	private $tracking;
79
80
	/**
81
	 * @var string
82
	 *
83
	 * @ORM\Column(name="campaign_code", type="string", length=50, nullable=true)
84
	 */
85
	private $campaignCode;
86
87
	/**
88
	 * @var \DateTime
89
	 * @Gedmo\Timestampable(on="create")
90
	 * @ORM\Column(type="datetime")
91
	 */
92
	private $createdAt;
93
94
	const STATUS_CONFIRMED = 1;
95
	const STATUS_NEUTRAL = 0;
96
	const STATUS_DELETED = -1;
97
	const STATUS_MODERATION = -2;
98
	const STATUS_ABORTED = -4;
99
	const STATUS_CANCELED = -8;
100
101
102
	/**
103
	 * Set name
104
	 *
105
	 * @param string $fullName
106
	 * @return self
107
	 */
108
	public function setFullName( $fullName ) {
109
		$this->fullName = $fullName;
110
111
		return $this;
112
	}
113
114
	/**
115
	 * Get name
116
	 *
117
	 * @return string
118
	 */
119
	public function getFullName() {
120
		return $this->fullName;
121
	}
122
123
	/**
124
	 * Set email
125
	 *
126
	 * @param string $email
127
	 * @return self
128
	 */
129
	public function setEmail( $email ) {
130
		$this->email = $email;
131
132
		return $this;
133
	}
134
135
	/**
136
	 * Get email
137
	 *
138
	 * @return string
139
	 */
140
	public function getEmail() {
141
		return $this->email;
142
	}
143
144
	/**
145
	 * Set export
146
	 *
147
	 * @param \DateTime $export
148
	 * @return self
149
	 */
150
	public function setExport( $export ) {
151
		$this->export = $export;
152
153
		return $this;
154
	}
155
156
	/**
157
	 * Get export
158
	 *
159
	 * @return \DateTime
160
	 */
161
	public function getExport() {
162
		return $this->export;
163
	}
164
165
	/**
166
	 * Set backup
167
	 *
168
	 * @param \DateTime $backup
169
	 * @return self
170
	 */
171
	public function setBackup( $backup ) {
172
		$this->backup = $backup;
173
174
		return $this;
175
	}
176
177
	/**
178
	 * Get backup
179
	 *
180
	 * @return \DateTime
181
	 */
182
	public function getBackup() {
183
		return $this->backup;
184
	}
185
186
	/**
187
	 * Set status
188
	 *
189
	 * @param integer $status
190
	 * @return self
191
	 */
192
	public function setStatus( $status ) {
193
		$this->status = $status;
194
195
		return $this;
196
	}
197
198
	/**
199
	 * Get status
200
	 *
201
	 * @return integer
202
	 */
203
	public function getStatus() {
204
		return $this->status;
205
	}
206 1
207 1
	/**
208
	 * Set guid
209 1
	 *
210
	 * @param string $confirmationCode
211
	 * @return self
212
	 */
213
	public function setConfirmationCode( $confirmationCode ) {
214
		$this->confirmationCode = $confirmationCode;
215
216
		return $this;
217 1
	}
218 1
219
	/**
220
	 * Get guid
221
	 *
222
	 * @return string
223
	 */
224
	public function getConfirmationCode() {
225
		return $this->confirmationCode;
226
	}
227
228
	/**
229
	 * Get id
230
	 *
231
	 * @return integer
232
	 */
233
	public function getId() {
234
		return $this->id;
235
	}
236
237
	/**
238
	 * @return Address
239
	 */
240
	public function getAddress() {
241
		return $this->address;
242
	}
243
244
	/**
245
	 * @return \DateTime
246
	 */
247
	public function getCreatedAt() {
248
		return $this->createdAt;
249
	}
250
251
	/**
252
	 * @param \DateTime $createdAt
253
	 * @return self
254
	 */
255
	public function setCreatedAt( $createdAt ) {
256
		$this->createdAt = $createdAt;
257
		return $this;
258
	}
259
260
	/**
261
	 * @return string
262
	 */
263
	public function getTracking() {
264
		return $this->tracking;
265
	}
266
267
	/**
268
	 * @param string $tracking
269
	 */
270
	public function setTracking( $tracking ) {
271
		$this->tracking = $tracking;
272
	}
273
274
	/**
275
	 * @param Address $address
276
	 */
277
	public function setAddress( $address ) {
278 1
		$this->address = $address;
279 1
	}
280
281
	public function isUnconfirmed() {
282 1
		return $this->getStatus() === self::STATUS_NEUTRAL;
283 1
	}
284 1
285
	public function getHexConfirmationCode() {
286
		return bin2hex( $this->confirmationCode );
287
	}
288
289
	public function setHexConfirmationCode( $confirmationCode ) {
290
		$this->confirmationCode = hex2bin( $confirmationCode );
291
	}
292
293
	public function setCampaignCode( string $campaignCode ) {
294
		$this->campaignCode = $campaignCode;
295
		return $this;
296
	}
297
298
	public function getCampaignCode(): string {
299
		return $this->campaignCode;
300
	}
301
302
}
303