Code Duplication    Length = 11-14 lines in 2 locations

src/BotManager.php 2 locations

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