| @@ 318-331 (lines=14) @@ | ||
| 315 | * |
|
| 316 | * @return int |
|
| 317 | */ |
|
| 318 | public function getLoopTime(): int |
|
| 319 | { |
|
| 320 | $loop_time = $this->params->getScriptParam('l'); |
|
| 321 | ||
| 322 | if (null === $loop_time) { |
|
| 323 | return 0; |
|
| 324 | } |
|
| 325 | ||
| 326 | if (is_string($loop_time) && '' === trim($loop_time)) { |
|
| 327 | return 604800; // Default to 7 days. |
|
| 328 | } |
|
| 329 | ||
| 330 | return max(0, (int) $loop_time); |
|
| 331 | } |
|
| 332 | ||
| 333 | /** |
|
| 334 | * Get the number of seconds the script should wait after each getUpdates request. |
|
| @@ 338-348 (lines=11) @@ | ||
| 335 | * |
|
| 336 | * @return int |
|
| 337 | */ |
|
| 338 | public function getLoopInterval(): int |
|
| 339 | { |
|
| 340 | $interval_time = $this->params->getScriptParam('i'); |
|
| 341 | ||
| 342 | if (null === $interval_time || (is_string($interval_time) && '' === trim($interval_time))) { |
|
| 343 | return 2; |
|
| 344 | } |
|
| 345 | ||
| 346 | // Minimum interval is 1 second. |
|
| 347 | return max(1, (int) $interval_time); |
|
| 348 | } |
|
| 349 | ||
| 350 | /** |
|
| 351 | * Loop the getUpdates method for the passed amount of seconds. |
|