Code Duplication    Length = 16-19 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 570-585 (lines=16) @@
567
   *
568
   * @return bool <p>This will return true or false indicating success of transaction</p>
569
   */
570
  public function beginTransaction(): bool
571
  {
572
    if ($this->_in_transaction === true) {
573
      $this->_debug->displayError('Error: mysql server already in transaction!', false);
574
575
      return false;
576
    }
577
578
    $this->clearErrors(); // needed for "$this->endTransaction()"
579
    $this->_in_transaction = true;
580
    $return = \mysqli_autocommit($this->link, false);
581
    if ($return === false) {
582
      $this->_in_transaction = false;
583
    }
584
585
    return $return;
586
  }
587
588
  /**
@@ 766-784 (lines=19) @@
763
   *
764
   * @return bool <p>This will return true or false indicating success of transactions.</p>
765
   */
766
  public function endTransaction(): bool
767
  {
768
    if ($this->_in_transaction === false) {
769
      $this->_debug->displayError('Error: mysql server is not in transaction!', false);
770
771
      return false;
772
    }
773
774
    if (!$this->errors()) {
775
      $return = \mysqli_commit($this->link);
776
    } else {
777
      $this->rollback();
778
      $return = false;
779
    }
780
781
    \mysqli_autocommit($this->link, true);
782
    $this->_in_transaction = false;
783
784
    return $return;
785
  }
786
787
  /**