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