Code Duplication    Length = 13-16 lines in 2 locations

src/Bot.php 2 locations

@@ 476-491 (lines=16) @@
473
            // just set $offset as the same value
474
            $offset = $this->redis->get($variable_name);
475
476
        } else {
477
            // Else get the offset from the id from the first update received
478
479
            do {
480
481
                $update = $this->getUpdates(0, 1);
482
483
            } while (empty($update));
484
485
            $offset = $update[0]['update_id'];
486
487
            $this->redis->set($variable_name, $offset);
488
489
            $update = null;
490
491
        }
492
493
        $this->initBot();
494
@@ 621-633 (lines=13) @@
618
        $sth = null;
619
620
        // Get the offset from the first update to update
621
        if ($offset === false) {
622
623
            do {
624
625
                $update = $this->getUpdates(0, 1);
626
627
            } while (empty($update));
628
629
            $offset = $update[0]['update_id'];
630
631
            $update = null;
632
633
        }
634
635
        // Prepare the query for updating the offset in the database
636
        $sth = $this->pdo->prepare('UPDATE "' . $table_name . '" SET "' . $column_name . '" = :new_offset');