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
  /**
@@ 756-774 (lines=19) @@
753
   *
754
   * @return bool <p>This will return true or false indicating success of transactions.</p>
755
   */
756
  public function endTransaction()
757
  {
758
    if ($this->_in_transaction === false) {
759
      $this->_debug->displayError('Error: mysql server is not in transaction!', false);
760
761
      return false;
762
    }
763
764
    if (!$this->errors()) {
765
      $return = \mysqli_commit($this->link);
766
    } else {
767
      $this->rollback();
768
      $return = false;
769
    }
770
771
    \mysqli_autocommit($this->link, true);
772
    $this->_in_transaction = false;
773
774
    return $return;
775
  }
776
777
  /**