Code Duplication    Length = 13-16 lines in 2 locations

src/Bot.php 2 locations

@@ 463-478 (lines=16) @@
460
                // just set $offset as the same value
461
                $offset = $this->redis->get($variable_name);
462
463
            } else {
464
                // Else get the offset from the id from the first update received
465
466
                $update = [];
467
468
                do {
469
                    $update = $this->getUpdates(0, 1);
470
                } while (empty($update));
471
472
                $offset = $update[0]['update_id'];
473
474
                $this->redis->set($variable_name, $offset);
475
476
                $update = null;
477
478
            }
479
480
            $this->initBot();
481
@@ 608-620 (lines=13) @@
605
        $sth = null;
606
607
        // Get the offset from the first update to update
608
        if ($offset === false) {
609
610
            $update = [];
611
612
            do {
613
                $update = $this->getUpdates(0, 1);
614
            } while (empty($update));
615
616
            $offset = $update[0]['update_id'];
617
618
            $update = null;
619
620
        }
621
622
        // Prepare the query for updating the offset in the database
623
        $sth = $this->pdo->prepare('UPDATE "' . $table_name . '" SET "' . $column_name . '" = :new_offset');