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