Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
pool.php
1<?php
2
4
5class Pool
6{
10 private $id;
11
15 private $projectId;
16
20 private $privateName;
21
25 private $publicDescription;
26
30 private $mayContainAdultContent;
31
35 private $willExpire;
36
40 private $rewardPerAssignment;
41
45 private $dynamicPricingConfig;
46
50 private $assignmentMaxDurationSeconds = 300;
51
55 private $qualityControl;
56
60 private $defaults;
61
62 private $autoAcceptSolutions = true;
63
67 private $filter = [];
68
72 public function getFilter(): array
73 {
74 return $this->filter;
75 }
76
82 public function setFilter(array $filter): Pool
83 {
84 $this->filter = $filter;
85
86 return $this;
87 }
88
94 public function addFilter(Filter $filter): Pool
95 {
96 $this->filter[] = $filter;
97
98 return $this;
99 }
100
104 public function getProjectId(): string
105 {
106 return $this->projectId;
107 }
108
114 public function setProjectId(string $projectId): Pool
115 {
116 $this->projectId = $projectId;
117
118 return $this;
119 }
120
124 public function getPrivateName(): string
125 {
126 return $this->privateName;
127 }
128
134 public function setPrivateName(string $privateName): Pool
135 {
136 $this->privateName = $privateName;
137
138 return $this;
139 }
140
144 public function isMayContainAdultContent(): bool
145 {
146 return $this->mayContainAdultContent;
147 }
148
154 public function setMayContainAdultContent(bool $mayContainAdultContent): Pool
155 {
156 $this->mayContainAdultContent = $mayContainAdultContent;
157
158 return $this;
159 }
160
164 public function getWillExpire(): string
165 {
166 return $this->willExpire;
167 }
168
174 public function setWillExpire(string $willExpire): Pool
175 {
176 $this->willExpire = $willExpire;
177
178 return $this;
179 }
180
184 public function getRewardPerAssignment(): float
185 {
186 return $this->rewardPerAssignment;
187 }
188
194 public function setRewardPerAssignment(float $rewardPerAssignment): Pool
195 {
196 $rewardPerAssignment = number_format(
197 (float)round(
198 $rewardPerAssignment,
199 2,
200 PHP_ROUND_HALF_DOWN
201 ),
202 2,
203 '.',
204 ''
205 );
206 $this->rewardPerAssignment = $rewardPerAssignment;
207
208 return $this;
209 }
210
215 {
216 return $this->dynamicPricingConfig;
217 }
218
224 public function setDynamicPricingConfig(PricingConfig $dynamicPricingConfig): Pool
225 {
226 $this->dynamicPricingConfig = $dynamicPricingConfig;
227
228 return $this;
229 }
230
234 public function getAssignmentMaxDurationSeconds(): int
235 {
236 return $this->assignmentMaxDurationSeconds;
237 }
238
244 public function setAssignmentMaxDurationSeconds(int $assignmentMaxDurationSeconds): Pool
245 {
246 $this->assignmentMaxDurationSeconds = $assignmentMaxDurationSeconds;
247
248 return $this;
249 }
250
255 {
256 return $this->qualityControl;
257 }
258
264 public function setQualityControl(QualityControl $qualityControl): Pool
265 {
266 $this->qualityControl = $qualityControl;
267
268 return $this;
269 }
270
274 public function getDefaults(): PoolDefaults
275 {
276 return $this->defaults;
277 }
278
284 public function setDefaults(PoolDefaults $defaults): Pool
285 {
286 $this->defaults = $defaults;
287
288 return $this;
289 }
290
294 public function getId(): ?int
295 {
296 return $this->id;
297 }
298
304 public function setId(int $id): Pool
305 {
306 $this->id = $id;
307
308 return $this;
309 }
310
314 public function getAutoAcceptSolutions()
315 {
316 return $this->autoAcceptSolutions;
317 }
318
324 public function setAutoAcceptSolutions($autoAcceptSolutions)
325 {
326 $this->autoAcceptSolutions = $autoAcceptSolutions;
327
328 return $this;
329 }
330
334 public function getPublicDescription(): string
335 {
336 return $this->publicDescription;
337 }
338
344 public function setPublicDescription(string $publicDescription): Pool
345 {
346 $this->publicDescription = $publicDescription;
347
348 return $this;
349 }
350
351 public function toArray():array
352 {
353 $resultArray = [
354 'project_id' => $this->projectId,
355 'private_name' => $this->privateName,
356 'public_description' => $this->publicDescription,
357 'may_contain_adult_content' => $this->mayContainAdultContent,
358 'will_expire' => $this->willExpire,
359 'reward_per_assignment' => $this->rewardPerAssignment,
360 'assignment_max_duration_seconds' => $this->assignmentMaxDurationSeconds,
361 'auto_accept_solutions' => $this->autoAcceptSolutions,
362 'defaults' => $this->defaults->toArray(),
363 ];
364
365 if(!empty($this->filter))
366 {
367 $resultArray['filter'] = [];
368 $resultArray['filter']['and'] = [];
369 foreach ($this->filter as $filter)
370 {
371 $resultArray['filter']['and'][] = $filter->toArray();
372 }
373 }
374
375 return $resultArray;
376 }
377}
setMayContainAdultContent(bool $mayContainAdultContent)
Definition pool.php:154
setPublicDescription(string $publicDescription)
Definition pool.php:344
setDynamicPricingConfig(PricingConfig $dynamicPricingConfig)
Definition pool.php:224
setQualityControl(QualityControl $qualityControl)
Definition pool.php:264
setAssignmentMaxDurationSeconds(int $assignmentMaxDurationSeconds)
Definition pool.php:244
setRewardPerAssignment(float $rewardPerAssignment)
Definition pool.php:194