@@ 377-390 (lines=14) @@ | ||
374 | * |
|
375 | * @return int |
|
376 | */ |
|
377 | public function getLoopTime(): int |
|
378 | { |
|
379 | $loop_time = $this->params->getScriptParam('l'); |
|
380 | ||
381 | if (null === $loop_time) { |
|
382 | return 0; |
|
383 | } |
|
384 | ||
385 | if (is_string($loop_time) && '' === trim($loop_time)) { |
|
386 | return 604800; // Default to 7 days. |
|
387 | } |
|
388 | ||
389 | return max(0, (int) $loop_time); |
|
390 | } |
|
391 | ||
392 | /** |
|
393 | * Get the number of seconds the script should wait after each getUpdates request. |
|
@@ 397-407 (lines=11) @@ | ||
394 | * |
|
395 | * @return int |
|
396 | */ |
|
397 | public function getLoopInterval(): int |
|
398 | { |
|
399 | $interval_time = $this->params->getScriptParam('i'); |
|
400 | ||
401 | if (null === $interval_time || (is_string($interval_time) && '' === trim($interval_time))) { |
|
402 | return 2; |
|
403 | } |
|
404 | ||
405 | // Minimum interval is 1 second. |
|
406 | return max(1, (int) $interval_time); |
|
407 | } |
|
408 | ||
409 | /** |
|
410 | * Loop the getUpdates method for the passed amount of seconds. |