Code Duplication    Length = 11-14 lines in 2 locations

src/BotManager.php 2 locations

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