| @@ 293-306 (lines=14) @@ | ||
| 290 | * |
|
| 291 | * @return int |
|
| 292 | */ |
|
| 293 | public function getLoopTime(): int |
|
| 294 | { |
|
| 295 | $loop_time = $this->params->getScriptParam('l'); |
|
| 296 | ||
| 297 | if (null === $loop_time) { |
|
| 298 | return 0; |
|
| 299 | } |
|
| 300 | ||
| 301 | if (is_string($loop_time) && '' === trim($loop_time)) { |
|
| 302 | return 604800; // Default to 7 days. |
|
| 303 | } |
|
| 304 | ||
| 305 | return max(0, (int)$loop_time); |
|
| 306 | } |
|
| 307 | ||
| 308 | /** |
|
| 309 | * Get the number of seconds the script should wait after each getUpdates request. |
|
| @@ 313-323 (lines=11) @@ | ||
| 310 | * |
|
| 311 | * @return int |
|
| 312 | */ |
|
| 313 | public function getLoopInterval(): int |
|
| 314 | { |
|
| 315 | $interval_time = $this->params->getScriptParam('i'); |
|
| 316 | ||
| 317 | if (null === $interval_time || (is_string($interval_time) && '' === trim($interval_time))) { |
|
| 318 | return 2; |
|
| 319 | } |
|
| 320 | ||
| 321 | // Minimum interval is 1 second. |
|
| 322 | return max(1, (int)$interval_time); |
|
| 323 | } |
|
| 324 | ||
| 325 | /** |
|
| 326 | * Loop the getUpdates method for the passed amount of seconds. |
|