Code Duplication    Length = 11-14 lines in 2 locations

src/BotManager.php 2 locations

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