1
|
|
|
<?php |
2
|
|
|
namespace Wonnova\SDK\Model; |
3
|
|
|
|
4
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
5
|
|
|
use Doctrine\Common\Collections\Collection; |
6
|
|
|
use JMS\Serializer\Annotation as JMS; |
7
|
|
|
use Wonnova\SDK\Common\WonnovaDateTimeParserTrait; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class Quest |
11
|
|
|
* @author Wonnova |
12
|
|
|
* @link http://www.wonnova.com |
13
|
|
|
*/ |
14
|
|
|
class Quest extends AbstractModel |
15
|
|
|
{ |
16
|
|
|
use WonnovaDateTimeParserTrait; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var \DateTime |
20
|
|
|
* @JMS\Type("WonnovaDateTime") |
21
|
|
|
*/ |
22
|
|
|
private $startDate; |
23
|
|
|
/** |
24
|
|
|
* @var string |
25
|
|
|
* @JMS\Type("string") |
26
|
|
|
*/ |
27
|
|
|
private $code; |
28
|
|
|
/** |
29
|
|
|
* @var bool |
30
|
|
|
* @JMS\Type("boolean") |
31
|
|
|
*/ |
32
|
|
|
private $generatesNotification; |
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
* @JMS\Type("string") |
36
|
|
|
*/ |
37
|
|
|
private $name; |
38
|
|
|
/** |
39
|
|
|
* @var string |
40
|
|
|
* @JMS\Type("string") |
41
|
|
|
*/ |
42
|
|
|
private $description; |
43
|
|
|
/** |
44
|
|
|
* @var int |
45
|
|
|
* @JMS\Type("integer") |
46
|
|
|
* @JMS\Accessor(getter="getProgress",setter="setProgress") |
47
|
|
|
*/ |
48
|
|
|
private $progress; |
49
|
|
|
/** |
50
|
|
|
* @var Collection|QuestStep[] |
51
|
|
|
* @JMS\Type("array<Wonnova\SDK\Model\QuestStep>") |
52
|
|
|
*/ |
53
|
|
|
private $questSteps; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @return \DateTime |
57
|
|
|
*/ |
58
|
2 |
|
public function getStartDate() |
59
|
|
|
{ |
60
|
2 |
|
return $this->startDate; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @param \DateTime|string $startDate |
65
|
|
|
* @return $this |
66
|
|
|
*/ |
67
|
1 |
|
public function setStartDate($startDate) |
68
|
|
|
{ |
69
|
1 |
|
$this->startDate = $this->parseWonnovaDateTime($startDate); |
70
|
1 |
|
return $this; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return string |
75
|
|
|
*/ |
76
|
3 |
|
public function getCode() |
77
|
|
|
{ |
78
|
3 |
|
return $this->code; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param string $code |
83
|
|
|
* @return $this |
84
|
|
|
*/ |
85
|
1 |
|
public function setCode($code) |
86
|
|
|
{ |
87
|
1 |
|
$this->code = $code; |
88
|
1 |
|
return $this; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return mixed |
93
|
|
|
*/ |
94
|
2 |
|
public function getGeneratesNotification() |
95
|
|
|
{ |
96
|
2 |
|
return $this->generatesNotification; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @param mixed $generatesNotification |
101
|
|
|
* @return $this |
102
|
|
|
*/ |
103
|
1 |
|
public function setGeneratesNotification($generatesNotification) |
104
|
|
|
{ |
105
|
1 |
|
$this->generatesNotification = $generatesNotification; |
106
|
1 |
|
return $this; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @return string |
111
|
|
|
*/ |
112
|
3 |
|
public function getName() |
113
|
|
|
{ |
114
|
3 |
|
return $this->name; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @param string $name |
119
|
|
|
* @return $this |
120
|
|
|
*/ |
121
|
1 |
|
public function setName($name) |
122
|
|
|
{ |
123
|
1 |
|
$this->name = $name; |
124
|
1 |
|
return $this; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @return string |
129
|
|
|
*/ |
130
|
2 |
|
public function getDescription() |
131
|
|
|
{ |
132
|
2 |
|
return $this->description; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @param string $description |
137
|
|
|
* @return $this |
138
|
|
|
*/ |
139
|
1 |
|
public function setDescription($description) |
140
|
|
|
{ |
141
|
1 |
|
$this->description = $description; |
142
|
1 |
|
return $this; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @return int |
147
|
|
|
*/ |
148
|
2 |
|
public function getProgress() |
149
|
|
|
{ |
150
|
2 |
|
return $this->progress; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @param int $progress |
155
|
|
|
* @return $this |
156
|
|
|
*/ |
157
|
2 |
|
public function setProgress($progress) |
158
|
|
|
{ |
159
|
2 |
|
$this->progress = $progress; |
160
|
2 |
|
return $this; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @return Collection|QuestStep[] |
165
|
|
|
*/ |
166
|
2 |
|
public function getQuestSteps() |
167
|
|
|
{ |
168
|
2 |
|
return $this->questSteps; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @param Collection|QuestStep[] $questSteps |
173
|
|
|
* @return $this |
174
|
|
|
*/ |
175
|
1 |
|
public function setQuestSteps($questSteps) |
176
|
|
|
{ |
177
|
1 |
|
$this->questSteps = is_array($questSteps) ? new ArrayCollection($questSteps) : $questSteps; |
178
|
1 |
|
return $this; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* This method is called via reflection, so it doesn't need to (and shouldn't) be exposed |
183
|
|
|
* It prevents the properties progress and questSteps to be null |
184
|
|
|
* |
185
|
|
|
* @JMS\PostDeserialize |
186
|
|
|
*/ |
187
|
2 |
|
private function postDeserialize() |
188
|
|
|
{ |
189
|
2 |
|
if (is_null($this->progress)) { |
190
|
1 |
|
$this->progress = 0; |
191
|
1 |
|
} |
192
|
2 |
|
$this->questSteps = new ArrayCollection(is_null($this->questSteps) ? [] : $this->questSteps); |
|
|
|
|
193
|
2 |
|
} |
194
|
|
|
} |
195
|
|
|
|
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.