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