1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* loi |
5
|
|
|
* |
6
|
|
|
* @author Noé Zufferey |
7
|
|
|
* @copyright Expansion - le jeu |
8
|
|
|
* |
9
|
|
|
* @package Demeter |
10
|
|
|
* @update 29.09.14 |
11
|
|
|
*/ |
12
|
|
|
namespace Asylamba\Modules\Demeter\Model\Law; |
13
|
|
|
|
14
|
|
|
class Law { |
15
|
|
|
const VOTATION = 0; |
16
|
|
|
const EFFECTIVE = 1; |
17
|
|
|
const OBSOLETE = 2; |
18
|
|
|
const REFUSED = 3; |
19
|
|
|
|
20
|
|
|
const SECTORTAX = 1; |
21
|
|
|
const SECTORNAME = 2; |
22
|
|
|
const COMTAXEXPORT = 3; |
23
|
|
|
const COMTAXIMPORT = 4; |
24
|
|
|
const MILITARYSUBVENTION = 5; |
25
|
|
|
const TECHNOLOGYTRANSFER = 6; |
26
|
|
|
const PEACEPACT = 7; |
27
|
|
|
const WARDECLARATION = 8; |
28
|
|
|
const TOTALALLIANCE = 9; |
29
|
|
|
const NEUTRALPACT = 10; |
30
|
|
|
const PUNITION = 11; |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
const VOTEDURATION = 86400; |
34
|
|
|
|
35
|
|
|
public $id = 0; |
36
|
|
|
public $rColor = 0; |
37
|
|
|
public $type = ''; |
38
|
|
|
public $options = array(); |
39
|
|
|
public $statement = 0; |
40
|
|
|
public $dEndVotation = ''; |
41
|
|
|
public $dEnd = ''; |
42
|
|
|
public $dCreation = ''; |
43
|
|
|
|
44
|
|
|
public $forVote = 0; |
45
|
|
|
public $againstVote = 0; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @param int $id |
49
|
|
|
* @return Law |
50
|
|
|
*/ |
51
|
|
|
public function setId($id) |
52
|
|
|
{ |
53
|
|
|
$this->id = $id; |
54
|
|
|
|
55
|
|
|
return $this; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return int |
60
|
|
|
*/ |
61
|
|
|
public function getId() |
62
|
|
|
{ |
63
|
|
|
return $this->id; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param int $factionId |
68
|
|
|
* @return Law |
69
|
|
|
*/ |
70
|
|
|
public function setFactionId($factionId) |
71
|
|
|
{ |
72
|
|
|
$this->rColor = $factionId; |
73
|
|
|
|
74
|
|
|
return $this; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @return int |
79
|
|
|
*/ |
80
|
|
|
public function getFactionId() |
81
|
|
|
{ |
82
|
|
|
return $this->rColor; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @param int $type |
87
|
|
|
* @return Law |
88
|
|
|
*/ |
89
|
|
|
public function setType($type) |
90
|
|
|
{ |
91
|
|
|
$this->type = $type; |
|
|
|
|
92
|
|
|
|
93
|
|
|
return $this; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return int |
98
|
|
|
*/ |
99
|
|
|
public function getType() |
100
|
|
|
{ |
101
|
|
|
return $this->type; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @param array $options |
106
|
|
|
* @return Law |
107
|
|
|
*/ |
108
|
|
|
public function setOptions($options) |
109
|
|
|
{ |
110
|
|
|
$this->options = $options; |
111
|
|
|
|
112
|
|
|
return $this; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @return array |
117
|
|
|
*/ |
118
|
|
|
public function getOptions() |
119
|
|
|
{ |
120
|
|
|
return $this->options; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @param int $statement |
125
|
|
|
* @return Law |
126
|
|
|
*/ |
127
|
|
|
public function setStatement($statement) |
128
|
|
|
{ |
129
|
|
|
$this->statement = $statement; |
130
|
|
|
|
131
|
|
|
return $this; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @return int |
136
|
|
|
*/ |
137
|
|
|
public function getStatement() |
138
|
|
|
{ |
139
|
|
|
return $this->statement; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* @param string $createdAt |
144
|
|
|
* @return Law |
145
|
|
|
*/ |
146
|
|
|
public function setCreatedAt($createdAt) |
147
|
|
|
{ |
148
|
|
|
$this->dCreation = $createdAt; |
149
|
|
|
|
150
|
|
|
return $this; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @return string |
155
|
|
|
*/ |
156
|
|
|
public function getCreatedAt() |
157
|
|
|
{ |
158
|
|
|
return $this->dCreation; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @param string $votedAt |
163
|
|
|
* @return Law |
164
|
|
|
*/ |
165
|
|
|
public function setVotedAt($votedAt) |
166
|
|
|
{ |
167
|
|
|
$this->dEndVotation = $votedAt; |
168
|
|
|
|
169
|
|
|
return $this; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @return string |
174
|
|
|
*/ |
175
|
|
|
public function getVotedAt() |
176
|
|
|
{ |
177
|
|
|
return $this->dEndVotation; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* @param string $endedAt |
182
|
|
|
* @return Law |
183
|
|
|
*/ |
184
|
|
|
public function setEndedAt($endedAt) |
185
|
|
|
{ |
186
|
|
|
$this->dEnd = $endedAt; |
187
|
|
|
|
188
|
|
|
return $this; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* @return string |
193
|
|
|
*/ |
194
|
|
|
public function getEndedAt() |
195
|
|
|
{ |
196
|
|
|
return $this->dEnd; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* @param int $nbPositiveVotes |
201
|
|
|
* @return Law |
202
|
|
|
*/ |
203
|
|
|
public function setNbPositiveVotes($nbPositiveVotes) |
204
|
|
|
{ |
205
|
|
|
$this->forVote = $nbPositiveVotes; |
206
|
|
|
|
207
|
|
|
return $this; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* @return int |
212
|
|
|
*/ |
213
|
|
|
public function getNbPositiveVotes() |
214
|
|
|
{ |
215
|
|
|
return $this->forVote; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* @param int $nbNegativeVotes |
220
|
|
|
* @return Law |
221
|
|
|
*/ |
222
|
|
|
public function setNbNegativeVotes($nbNegativeVotes) |
223
|
|
|
{ |
224
|
|
|
$this->againstVote = $nbNegativeVotes; |
225
|
|
|
|
226
|
|
|
return $this; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @return int |
231
|
|
|
*/ |
232
|
|
|
public function getNbNegativeVotes() |
233
|
|
|
{ |
234
|
|
|
return $this->againstVote; |
235
|
|
|
} |
236
|
|
|
} |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.