Code Duplication    Length = 11-14 lines in 2 locations

src/BotManager.php 2 locations

@@ 315-328 (lines=14) @@
312
     *
313
     * @return int
314
     */
315
    public function getLoopTime(): int
316
    {
317
        $loop_time = $this->params->getScriptParam('l');
318
319
        if (null === $loop_time) {
320
            return 0;
321
        }
322
323
        if (is_string($loop_time) && '' === trim($loop_time)) {
324
            return 604800; // Default to 7 days.
325
        }
326
327
        return max(0, (int)$loop_time);
328
    }
329
330
    /**
331
     * Get the number of seconds the script should wait after each getUpdates request.
@@ 335-345 (lines=11) @@
332
     *
333
     * @return int
334
     */
335
    public function getLoopInterval(): int
336
    {
337
        $interval_time = $this->params->getScriptParam('i');
338
339
        if (null === $interval_time || (is_string($interval_time) && '' === trim($interval_time))) {
340
            return 2;
341
        }
342
343
        // Minimum interval is 1 second.
344
        return max(1, (int)$interval_time);
345
    }
346
347
    /**
348
     * Loop the getUpdates method for the passed amount of seconds.