Code Duplication    Length = 26-26 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 713-738 (lines=26) @@
710
     *
711
     * @return bool <p>bool true on success, false otherwise.</p>
712
     */
713
    public function commit(): bool
714
    {
715
        if ($this->in_transaction === false) {
716
            $this->debug->displayError('Error: mysql server is not in transaction!', false);
717
718
            return false;
719
        }
720
721
        if ($this->mysqli_link) {
722
            $return = \mysqli_commit($this->mysqli_link);
723
            \mysqli_autocommit($this->mysqli_link, true);
724
        } elseif ($this->isDoctrinePDOConnection() === true) {
725
            $this->doctrine_connection->commit();
726
            $this->doctrine_connection->setAutoCommit(true);
727
728
            if ($this->doctrine_connection->isAutoCommit() === true) {
729
                $return = true;
730
            } else {
731
                $return = false;
732
            }
733
        }
734
735
        $this->in_transaction = false;
736
737
        return $return;
738
    }
739
740
    /**
741
     * Open a new connection to the MySQL server.
@@ 2075-2100 (lines=26) @@
2072
     *
2073
     * @return bool <p>bool true on success, false otherwise.</p>
2074
     */
2075
    public function rollback(): bool
2076
    {
2077
        if ($this->in_transaction === false) {
2078
            $this->debug->displayError('Error: mysql server is not in transaction!', false);
2079
2080
            return false;
2081
        }
2082
2083
        if ($this->mysqli_link) {
2084
            $return = \mysqli_rollback($this->mysqli_link);
2085
            \mysqli_autocommit($this->mysqli_link, true);
2086
        } elseif ($this->isDoctrinePDOConnection() === true) {
2087
            $this->doctrine_connection->rollBack();
2088
            $this->doctrine_connection->setAutoCommit(true);
2089
2090
            if ($this->doctrine_connection->isAutoCommit() === true) {
2091
                $return = true;
2092
            } else {
2093
                $return = false;
2094
            }
2095
        }
2096
2097
        $this->in_transaction = false;
2098
2099
        return $return;
2100
    }
2101
2102
    /**
2103
     * Try to secure a variable, so can you use it in sql-queries.