Code Duplication    Length = 11-14 lines in 2 locations

src/BotManager.php 2 locations

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