Completed
Push — master ( 9d1ccd...465a60 )
by Leszek
02:44
created

Subscription::getTracking()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
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 \DateTime
82
	 * @Gedmo\Timestampable(on="create")
83
	 * @ORM\Column(type="datetime")
84
	 */
85
	private $createdAt;
86
87
	const STATUS_CONFIRMED = 1;
88
	const STATUS_NEUTRAL = 0;
89
	const STATUS_DELETED = -1;
90
	const STATUS_MODERATION = -2;
91
	const STATUS_ABORTED = -4;
92
	const STATUS_CANCELED = -8;
93
94
95
	/**
96
	 * Set name
97
	 *
98
	 * @param string $fullName
99
	 * @return self
100
	 */
101
	public function setFullName( $fullName ) {
102
		$this->fullName = $fullName;
103
104
		return $this;
105
	}
106
107
	/**
108
	 * Get name
109
	 *
110
	 * @return string
111
	 */
112
	public function getFullName() {
113
		return $this->fullName;
114
	}
115
116
	/**
117
	 * Set email
118
	 *
119
	 * @param string $email
120
	 * @return self
121
	 */
122
	public function setEmail( $email ) {
123
		$this->email = $email;
124
125
		return $this;
126
	}
127
128
	/**
129
	 * Get email
130
	 *
131
	 * @return string
132
	 */
133
	public function getEmail() {
134
		return $this->email;
135
	}
136
137
	/**
138
	 * Set export
139
	 *
140
	 * @param \DateTime $export
141
	 * @return self
142
	 */
143
	public function setExport( $export ) {
144
		$this->export = $export;
145
146
		return $this;
147
	}
148
149
	/**
150
	 * Get export
151
	 *
152
	 * @return \DateTime
153
	 */
154
	public function getExport() {
155
		return $this->export;
156
	}
157
158
	/**
159
	 * Set backup
160
	 *
161
	 * @param \DateTime $backup
162
	 * @return self
163
	 */
164
	public function setBackup( $backup ) {
165
		$this->backup = $backup;
166
167
		return $this;
168
	}
169
170
	/**
171
	 * Get backup
172
	 *
173
	 * @return \DateTime
174
	 */
175
	public function getBackup() {
176
		return $this->backup;
177
	}
178
179
	/**
180
	 * Set status
181
	 *
182
	 * @param integer $status
183
	 * @return self
184
	 */
185
	public function setStatus( $status ) {
186
		$this->status = $status;
187
188
		return $this;
189
	}
190
191
	/**
192
	 * Get status
193
	 *
194
	 * @return integer
195
	 */
196
	public function getStatus() {
197
		return $this->status;
198
	}
199
200
	/**
201
	 * Set guid
202
	 *
203
	 * @param string $confirmationCode
204
	 * @return self
205
	 */
206
	public function setConfirmationCode( $confirmationCode ) {
207
		$this->confirmationCode = $confirmationCode;
208
209
		return $this;
210
	}
211
212
	/**
213
	 * Get guid
214
	 *
215
	 * @return string
216
	 */
217
	public function getConfirmationCode() {
218
		return $this->confirmationCode;
219
	}
220
221
	/**
222
	 * Get id
223
	 *
224
	 * @return integer
225
	 */
226
	public function getId() {
227
		return $this->id;
228
	}
229
230
	/**
231
	 * @return Address
232
	 */
233
	public function getAddress() {
234
		return $this->address;
235
	}
236
237
	/**
238
	 * @return \DateTime
239
	 */
240
	public function getCreatedAt() {
241
		return $this->createdAt;
242
	}
243
244
	/**
245
	 * @param \DateTime $createdAt
246
	 * @return self
247
	 */
248
	public function setCreatedAt( $createdAt ) {
249
		$this->createdAt = $createdAt;
250
		return $this;
251
	}
252
253
	/**
254
	 * @return string
255
	 */
256
	public function getTracking() {
257
		return $this->tracking;
258
	}
259
260
	/**
261
	 * @param string $tracking
262
	 */
263
	public function setTracking( $tracking ) {
264
		$this->tracking = $tracking;
265
	}
266
267
	/**
268
	 * @param Address $address
269
	 */
270
	public function setAddress( $address ) {
271
		$this->address = $address;
272
	}
273
274
	public function isUnconfirmed() {
275
		return $this->getStatus() === self::STATUS_NEUTRAL;
276
	}
277
278
	public function getHexConfirmationCode() {
279
		return bin2hex( $this->confirmationCode );
280
	}
281
282
	public function setHexConfirmationCode( $confirmationCode ) {
283
		$this->confirmationCode = hex2bin( $confirmationCode );
284
	}
285
286
}
287