Completed
Pull Request — master (#41)
by Leszek
04:36
created

Subscription   A

Complexity

Total Complexity 16

Size/Duplication

Total Lines 221
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 16
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 221
rs 10

16 Methods

Rating   Name   Duplication   Size   Complexity  
A setFullName() 0 5 1
A getFullName() 0 3 1
A setEmail() 0 5 1
A getEmail() 0 3 1
A setExport() 0 5 1
A getExport() 0 3 1
A setBackup() 0 5 1
A getBackup() 0 3 1
A setStatus() 0 5 1
A getStatus() 0 3 1
A setConfirmationCode() 0 5 1
A getConfirmationCode() 0 3 1
A getId() 0 3 1
A getAddress() 0 3 1
A setAddress() 0 3 1
A isUnconfirmed() 0 3 1
1
<?php
2
3
namespace WMDE\Fundraising\Entities;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
/**
8
 * @since 2.0
9
 *
10
 * @ORM\Table( name="subscription" )
11
 * @ORM\Entity
12
 */
13
class Subscription {
14
15
	/**
16
	 * @var string
17
	 *
18
	 * @ORM\Column(name="full_name", type="string", length=250, options={"default":""}, nullable=false)
19
	 */
20
	private $fullName = '';
21
22
	/**
23
	 * @var string
24
	 *
25
	 * @ORM\Column(name="email", type="string", length=250, options={"default":""}, nullable=false)
26
	 */
27
	private $email = '';
28
29
	/**
30
	 * @var \DateTime
31
	 *
32
	 * @ORM\Column(name="export", type="datetime", nullable=true)
33
	 */
34
	private $export;
35
36
	/**
37
	 * @var \DateTime
38
	 *
39
	 * @ORM\Column(name="backup", type="datetime", nullable=true)
40
	 */
41
	private $backup;
42
43
	/**
44
	 * @var integer
45
	 *
46
	 * @ORM\Column(name="status", type="smallint", options={"default":0}, nullable=true)
47
	 */
48
	private $status = 0;
49
50
	/**
51
	 * @var string
52
	 *
53
	 * @ORM\Column(name="confirmationCode", type="blob", length=16, nullable=true)
54
	 */
55
	private $confirmationCode;
56
57
	/**
58
	 * @var integer
59
	 *
60
	 * @ORM\Column(name="id", type="integer")
61
	 * @ORM\Id
62
	 * @ORM\GeneratedValue(strategy="IDENTITY")
63
	 */
64
	private $id;
65
66
	/**
67
	 * @ORM\ManyToOne(targetEntity="Address")
68
	 * @ORM\JoinColumn(name="address_id", referencedColumnName="id")
69
	 */
70
	private $address;
71
72
	const STATUS_CONFIRMED = 1;
73
	const STATUS_NEUTRAL = 0;
74
	const STATUS_DELETED = -1;
75
	const STATUS_MODERATION = -2;
76
	const STATUS_ABORTED = -4;
77
	const STATUS_CANCELED = -8;
78
79
80
	/**
81
	 * Set name
82
	 *
83
	 * @param string $fullName
84
	 * @return Subscription
85
	 */
86
	public function setFullName( $fullName ) {
87
		$this->fullName = $fullName;
88
89
		return $this;
90
	}
91
92
	/**
93
	 * Get name
94
	 *
95
	 * @return string
96
	 */
97
	public function getFullName() {
98
		return $this->fullName;
99
	}
100
101
	/**
102
	 * Set email
103
	 *
104
	 * @param string $email
105
	 * @return Subscription
106
	 */
107
	public function setEmail( $email ) {
108
		$this->email = $email;
109
110
		return $this;
111
	}
112
113
	/**
114
	 * Get email
115
	 *
116
	 * @return string
117
	 */
118
	public function getEmail() {
119
		return $this->email;
120
	}
121
122
	/**
123
	 * Set export
124
	 *
125
	 * @param \DateTime $export
126
	 * @return Subscription
127
	 */
128
	public function setExport( $export ) {
129
		$this->export = $export;
130
131
		return $this;
132
	}
133
134
	/**
135
	 * Get export
136
	 *
137
	 * @return \DateTime
138
	 */
139
	public function getExport() {
140
		return $this->export;
141
	}
142
143
	/**
144
	 * Set backup
145
	 *
146
	 * @param \DateTime $backup
147
	 * @return Subscription
148
	 */
149
	public function setBackup( $backup ) {
150
		$this->backup = $backup;
151
152
		return $this;
153
	}
154
155
	/**
156
	 * Get backup
157
	 *
158
	 * @return \DateTime
159
	 */
160
	public function getBackup() {
161
		return $this->backup;
162
	}
163
164
	/**
165
	 * Set status
166
	 *
167
	 * @param integer $status
168
	 * @return Subscription
169
	 */
170
	public function setStatus( $status ) {
171
		$this->status = $status;
172
173
		return $this;
174
	}
175
176
	/**
177
	 * Get status
178
	 *
179
	 * @return integer
180
	 */
181
	public function getStatus() {
182
		return $this->status;
183
	}
184
185
	/**
186
	 * Set guid
187
	 *
188
	 * @param string $confirmationCode
189
	 * @return Subscription
190
	 */
191
	public function setConfirmationCode( $confirmationCode ) {
192
		$this->confirmationCode = $confirmationCode;
193
194
		return $this;
195
	}
196
197
	/**
198
	 * Get guid
199
	 *
200
	 * @return string
201
	 */
202
	public function getConfirmationCode() {
203
		return $this->confirmationCode;
204
	}
205
206
	/**
207
	 * Get id
208
	 *
209
	 * @return integer
210
	 */
211
	public function getId() {
212
		return $this->id;
213
	}
214
215
	/**
216
	 * @return Address
217
	 */
218
	public function getAddress() {
219
		return $this->address;
220
	}
221
222
	/**
223
	 * @param Address $address
224
	 */
225
	public function setAddress( $address ) {
226
		$this->address = $address;
227
	}
228
229
	public function isUnconfirmed() {
230
		return $this->getStatus() === self::STATUS_NEUTRAL;
231
	}
232
233
}
234