Code Duplication    Length = 26-26 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 726-751 (lines=26) @@
723
   *
724
   * @return bool <p>bool true on success, false otherwise.</p>
725
   */
726
  public function commit(): bool
727
  {
728
    if ($this->in_transaction === false) {
729
      $this->debug->displayError('Error: mysql server is not in transaction!', false);
730
731
      return false;
732
    }
733
734
    if ($this->mysqli_link) {
735
      $return = \mysqli_commit($this->mysqli_link);
736
      \mysqli_autocommit($this->mysqli_link, true);
737
    } elseif ($this->isDoctrinePDOConnection() === true) {
738
      $this->doctrine_connection->commit();
739
      $this->doctrine_connection->setAutoCommit(true);
740
741
      if ($this->doctrine_connection->isAutoCommit() === true) {
742
        $return = true;
743
      } else {
744
        $return = false;
745
      }
746
    }
747
748
    $this->in_transaction = false;
749
750
    return $return;
751
  }
752
753
  /**
754
   * Open a new connection to the MySQL server.
@@ 2118-2143 (lines=26) @@
2115
   *
2116
   * @return bool <p>bool true on success, false otherwise.</p>
2117
   */
2118
  public function rollback(): bool
2119
  {
2120
    if ($this->in_transaction === false) {
2121
      $this->debug->displayError('Error: mysql server is not in transaction!', false);
2122
2123
      return false;
2124
    }
2125
2126
    if ($this->mysqli_link) {
2127
      $return = \mysqli_rollback($this->mysqli_link);
2128
      \mysqli_autocommit($this->mysqli_link, true);
2129
    } elseif ($this->isDoctrinePDOConnection() === true) {
2130
      $this->doctrine_connection->rollBack();
2131
      $this->doctrine_connection->setAutoCommit(true);
2132
2133
      if ($this->doctrine_connection->isAutoCommit() === true) {
2134
        $return = true;
2135
      } else {
2136
        $return = false;
2137
      }
2138
    }
2139
2140
    $this->in_transaction = false;
2141
2142
    return $return;
2143
  }
2144
2145
  /**
2146
   * Try to secure a variable, so can you use it in sql-queries.