Code Duplication    Length = 16-19 lines in 2 locations

src/voku/db/DB.php 2 locations

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