1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Stack Exchange Api Client library. |
5
|
|
|
* |
6
|
|
|
* (c) Beñat Espiña <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
/* |
14
|
|
|
* This file is part of the Stack Exchange Api Client library. |
15
|
|
|
* |
16
|
|
|
* (c) Beñat Espiña <[email protected]> |
17
|
|
|
* |
18
|
|
|
* For the full copyright and license information, please view the LICENSE |
19
|
|
|
* file that was distributed with this source code. |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace BenatEspina\StackExchangeApiClient\Model; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Class filter model class. |
26
|
|
|
* |
27
|
|
|
* @author Beñat Espiña <[email protected]> |
28
|
|
|
*/ |
29
|
|
|
class FlagOption implements Model |
30
|
|
|
{ |
31
|
|
|
protected $count; |
32
|
|
|
protected $description; |
33
|
|
|
protected $dialogTitle; |
34
|
|
|
protected $hasFlagged; |
35
|
|
|
protected $optionId; |
36
|
|
|
protected $subOptions; |
37
|
|
|
protected $title; |
38
|
|
|
protected $requiresComment; |
39
|
|
|
protected $requiresQuestionId; |
40
|
|
|
protected $requiresSite; |
41
|
|
|
|
42
|
|
|
public static function fromJson(array $data) |
43
|
|
|
{ |
44
|
|
|
$instance = new self(); |
45
|
|
|
$instance |
46
|
|
|
->setCount(array_key_exists('count', $data) ? $data['count'] : null) |
47
|
|
|
->setDescription(array_key_exists('description', $data) ? $data['description'] : null) |
48
|
|
|
->setDialogTitle(array_key_exists('dialog_title', $data) ? $data['dialog_title'] : null) |
49
|
|
|
->setHasFlagged(array_key_exists('has_flagged', $data) ? $data['has_flagged'] : null) |
50
|
|
|
->setOptionId(array_key_exists('option_id', $data) ? $data['option_id'] : null) |
51
|
|
|
->setRequiresComment(array_key_exists('requires_comment', $data) ? $data['requires_comment'] : null) |
52
|
|
|
->setRequiresQuestionId( |
53
|
|
|
array_key_exists('requires_question_id', $data) |
54
|
|
|
? $data['requires_question_id'] |
55
|
|
|
: null |
56
|
|
|
) |
57
|
|
|
->setRequiresSite(array_key_exists('requires_site', $data) ? $data['requires_site'] : null) |
58
|
|
|
->setSubOptions(array_key_exists('sub_options', $data) ? $data['sub_options'] : null) |
59
|
|
|
->setTitle(array_key_exists('title', $data) ? $data['title'] : null); |
60
|
|
|
|
61
|
|
|
return $instance; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public static function fromProperties( |
65
|
|
|
$count, |
66
|
|
|
$description, |
67
|
|
|
$dialogTitle, |
68
|
|
|
$hasFlagged, |
69
|
|
|
$optionId, |
70
|
|
|
array $subOptions, |
71
|
|
|
$title, |
72
|
|
|
$requiresComment, |
73
|
|
|
$requiresQuestionId, |
74
|
|
|
$requiresSite |
75
|
|
|
) { |
76
|
|
|
$instance = new self(); |
77
|
|
|
$instance |
78
|
|
|
->setCount($count) |
79
|
|
|
->setDescription($description) |
80
|
|
|
->setDialogTitle($dialogTitle) |
81
|
|
|
->setHasFlagged($hasFlagged) |
82
|
|
|
->setOptionId($optionId) |
83
|
|
|
->setRequiresComment($requiresComment) |
84
|
|
|
->setRequiresQuestionId($requiresQuestionId) |
85
|
|
|
->setRequiresSite($requiresSite) |
86
|
|
|
->setSubOptions($subOptions) |
87
|
|
|
->setTitle($title); |
88
|
|
|
|
89
|
|
|
return $instance; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function setCount($count) |
93
|
|
|
{ |
94
|
|
|
$this->count = $count; |
95
|
|
|
|
96
|
|
|
return $this; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
public function getCount() |
|
|
|
|
100
|
|
|
{ |
101
|
|
|
return $this->count; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function setDescription($description) |
105
|
|
|
{ |
106
|
|
|
$this->description = $description; |
107
|
|
|
|
108
|
|
|
return $this; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
public function getDescription() |
|
|
|
|
112
|
|
|
{ |
113
|
|
|
return $this->description; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
public function setDialogTitle($dialogTitle) |
117
|
|
|
{ |
118
|
|
|
$this->dialogTitle = $dialogTitle; |
119
|
|
|
|
120
|
|
|
return $this; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
public function getDialogTitle() |
|
|
|
|
124
|
|
|
{ |
125
|
|
|
return $this->dialogTitle; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
public function setHasFlagged($hasFlagged) |
129
|
|
|
{ |
130
|
|
|
$this->hasFlagged = $hasFlagged; |
131
|
|
|
|
132
|
|
|
return $this; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
public function hasFlagged() |
|
|
|
|
136
|
|
|
{ |
137
|
|
|
return $this->hasFlagged; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
public function setOptionId($optionId) |
141
|
|
|
{ |
142
|
|
|
$this->optionId = $optionId; |
143
|
|
|
|
144
|
|
|
return $this; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
public function getOptionId() |
|
|
|
|
148
|
|
|
{ |
149
|
|
|
return $this->optionId; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
public function setSubOptions(array $subOptions = []) |
153
|
|
|
{ |
154
|
|
|
$this->subOptions = $subOptions; |
155
|
|
|
|
156
|
|
|
return $this; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
public function getSubOptions() |
160
|
|
|
{ |
161
|
|
|
return $this->subOptions; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
public function setTitle($title) |
165
|
|
|
{ |
166
|
|
|
$this->title = $title; |
167
|
|
|
|
168
|
|
|
return $this; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
public function getTitle() |
|
|
|
|
172
|
|
|
{ |
173
|
|
|
return $this->title; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
public function setRequiresComment($requiresComment) |
177
|
|
|
{ |
178
|
|
|
$this->requiresComment = $requiresComment; |
179
|
|
|
|
180
|
|
|
return $this; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
public function isRequiresComment() |
|
|
|
|
184
|
|
|
{ |
185
|
|
|
return $this->requiresComment; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
public function setRequiresQuestionId($requiresQuestionId) |
189
|
|
|
{ |
190
|
|
|
$this->requiresQuestionId = $requiresQuestionId; |
191
|
|
|
|
192
|
|
|
return $this; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
public function isRequiresQuestionId() |
|
|
|
|
196
|
|
|
{ |
197
|
|
|
return $this->requiresQuestionId; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
public function setRequiresSite($requiresSite) |
201
|
|
|
{ |
202
|
|
|
$this->requiresSite = $requiresSite; |
203
|
|
|
|
204
|
|
|
return $this; |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
public function isRequiresSite() |
|
|
|
|
208
|
|
|
{ |
209
|
|
|
return $this->requiresSite; |
210
|
|
|
} |
211
|
|
|
} |
212
|
|
|
|
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.