@@ 303-316 (lines=14) @@ | ||
300 | * |
|
301 | * @return int |
|
302 | */ |
|
303 | public function getLoopTime(): int |
|
304 | { |
|
305 | $loop_time = $this->params->getScriptParam('l'); |
|
306 | ||
307 | if (null === $loop_time) { |
|
308 | return 0; |
|
309 | } |
|
310 | ||
311 | if (is_string($loop_time) && '' === trim($loop_time)) { |
|
312 | return 604800; // Default to 7 days. |
|
313 | } |
|
314 | ||
315 | return max(0, (int)$loop_time); |
|
316 | } |
|
317 | ||
318 | /** |
|
319 | * Get the number of seconds the script should wait after each getUpdates request. |
|
@@ 323-333 (lines=11) @@ | ||
320 | * |
|
321 | * @return int |
|
322 | */ |
|
323 | public function getLoopInterval(): int |
|
324 | { |
|
325 | $interval_time = $this->params->getScriptParam('i'); |
|
326 | ||
327 | if (null === $interval_time || (is_string($interval_time) && '' === trim($interval_time))) { |
|
328 | return 2; |
|
329 | } |
|
330 | ||
331 | // Minimum interval is 1 second. |
|
332 | return max(1, (int)$interval_time); |
|
333 | } |
|
334 | ||
335 | /** |
|
336 | * Loop the getUpdates method for the passed amount of seconds. |