@@ 271-284 (lines=14) @@ | ||
268 | * |
|
269 | * @return int |
|
270 | */ |
|
271 | public function getLoopTime(): int |
|
272 | { |
|
273 | $loop_time = $this->params->getScriptParam('l'); |
|
274 | ||
275 | if (null === $loop_time) { |
|
276 | return 0; |
|
277 | } |
|
278 | ||
279 | if (is_string($loop_time) && '' === trim($loop_time)) { |
|
280 | return 604800; // Default to 7 days. |
|
281 | } |
|
282 | ||
283 | return max(0, (int)$loop_time); |
|
284 | } |
|
285 | ||
286 | /** |
|
287 | * Get the number of seconds the script should wait after each getUpdates request. |
|
@@ 291-301 (lines=11) @@ | ||
288 | * |
|
289 | * @return int |
|
290 | */ |
|
291 | public function getLoopInterval(): int |
|
292 | { |
|
293 | $interval_time = $this->params->getScriptParam('i'); |
|
294 | ||
295 | if (null === $interval_time || (is_string($interval_time) && '' === trim($interval_time))) { |
|
296 | return 2; |
|
297 | } |
|
298 | ||
299 | // Minimum interval is 1 second. |
|
300 | return max(1, (int)$interval_time); |
|
301 | } |
|
302 | ||
303 | /** |
|
304 | * Loop the getUpdates method for the passed amount of seconds. |