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