Code Duplication    Length = 16-19 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 522-537 (lines=16) @@
519
   *
520
   * @return bool <p>This will return true or false indicating success of transaction</p>
521
   */
522
  public function beginTransaction()
523
  {
524
    if ($this->_in_transaction === true) {
525
      $this->_debug->displayError('Error: mysql server already in transaction!', false);
526
      return false;
527
    }
528
529
    $this->clearErrors(); // needed for "$this->endTransaction()"
530
    $this->_in_transaction = true;
531
    $return = \mysqli_autocommit($this->link, false);
532
    if ($return === false) {
533
      $this->_in_transaction = false;
534
    }
535
536
    return $return;
537
  }
538
539
540
  /**
@@ 686-704 (lines=19) @@
683
   *
684
   * @return bool <p>This will return true or false indicating success of transactions.</p>
685
   */
686
  public function endTransaction()
687
  {
688
    if ($this->_in_transaction === false) {
689
      $this->_debug->displayError('Error: mysql server is not in transaction!', false);
690
      return false;
691
    }
692
693
    if (!$this->errors()) {
694
      $return = \mysqli_commit($this->link);
695
    } else {
696
      $this->rollback();
697
      $return = false;
698
    }
699
700
    \mysqli_autocommit($this->link, true);
701
    $this->_in_transaction = false;
702
703
    return $return;
704
  }
705
706
  /**
707
   * Get all errors from "$this->_errors".