| @@ 345-358 (lines=14) @@ | ||
| 342 | * |
|
| 343 | * @return int |
|
| 344 | */ |
|
| 345 | public function getLoopTime(): int |
|
| 346 | { |
|
| 347 | $loop_time = $this->params->getScriptParam('l'); |
|
| 348 | ||
| 349 | if (null === $loop_time) { |
|
| 350 | return 0; |
|
| 351 | } |
|
| 352 | ||
| 353 | if (is_string($loop_time) && '' === trim($loop_time)) { |
|
| 354 | return 604800; // Default to 7 days. |
|
| 355 | } |
|
| 356 | ||
| 357 | return max(0, (int) $loop_time); |
|
| 358 | } |
|
| 359 | ||
| 360 | /** |
|
| 361 | * Get the number of seconds the script should wait after each getUpdates request. |
|
| @@ 365-375 (lines=11) @@ | ||
| 362 | * |
|
| 363 | * @return int |
|
| 364 | */ |
|
| 365 | public function getLoopInterval(): int |
|
| 366 | { |
|
| 367 | $interval_time = $this->params->getScriptParam('i'); |
|
| 368 | ||
| 369 | if (null === $interval_time || (is_string($interval_time) && '' === trim($interval_time))) { |
|
| 370 | return 2; |
|
| 371 | } |
|
| 372 | ||
| 373 | // Minimum interval is 1 second. |
|
| 374 | return max(1, (int) $interval_time); |
|
| 375 | } |
|
| 376 | ||
| 377 | /** |
|
| 378 | * Loop the getUpdates method for the passed amount of seconds. |
|