Code Duplication    Length = 11-14 lines in 2 locations

src/BotManager.php 2 locations

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