Code Duplication    Length = 16-19 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 560-575 (lines=16) @@
557
   *
558
   * @return bool <p>This will return true or false indicating success of transaction</p>
559
   */
560
  public function beginTransaction()
561
  {
562
    if ($this->_in_transaction === true) {
563
      $this->_debug->displayError('Error: mysql server already in transaction!', false);
564
565
      return false;
566
    }
567
568
    $this->clearErrors(); // needed for "$this->endTransaction()"
569
    $this->_in_transaction = true;
570
    $return = \mysqli_autocommit($this->link, false);
571
    if ($return === false) {
572
      $this->_in_transaction = false;
573
    }
574
575
    return $return;
576
  }
577
578
  /**
@@ 747-765 (lines=19) @@
744
   *
745
   * @return bool <p>This will return true or false indicating success of transactions.</p>
746
   */
747
  public function endTransaction()
748
  {
749
    if ($this->_in_transaction === false) {
750
      $this->_debug->displayError('Error: mysql server is not in transaction!', false);
751
752
      return false;
753
    }
754
755
    if (!$this->errors()) {
756
      $return = \mysqli_commit($this->link);
757
    } else {
758
      $this->rollback();
759
      $return = false;
760
    }
761
762
    \mysqli_autocommit($this->link, true);
763
    $this->_in_transaction = false;
764
765
    return $return;
766
  }
767
768
  /**