Code Duplication    Length = 27-27 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 877-903 (lines=27) @@
874
     *
875
     * @return false|int <p>false on error</p>
876
     */
877
    public function delete(string $table, $where, string $databaseName = null)
878
    {
879
        // init
880
        $table = \trim($table);
881
882
        if ($table === '') {
883
            $this->debug->displayError('Invalid table name, table name in empty.', false);
884
885
            return false;
886
        }
887
888
        if (\is_string($where)) {
889
            $WHERE = $this->escape($where, false);
890
        } elseif (\is_array($where)) {
891
            $WHERE = $this->_parseArrayPair($where, 'AND');
892
        } else {
893
            $WHERE = '';
894
        }
895
896
        if ($databaseName) {
897
            $databaseName = $this->quote_string(\trim($databaseName)) . '.';
898
        }
899
900
        $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE (${WHERE})";
901
902
        return $this->query($sql);
903
    }
904
905
    /**
906
     * Ends a transaction and commits if no errors, then ends autocommit.
@@ 2221-2247 (lines=27) @@
2218
     *
2219
     * @return false|Result <p>false on error</p>
2220
     */
2221
    public function select(string $table, $where = '1=1', string $databaseName = null)
2222
    {
2223
        // init
2224
        $table = \trim($table);
2225
2226
        if ($table === '') {
2227
            $this->debug->displayError('Invalid table name, table name in empty.', false);
2228
2229
            return false;
2230
        }
2231
2232
        if (\is_string($where)) {
2233
            $WHERE = $this->escape($where, false);
2234
        } elseif (\is_array($where)) {
2235
            $WHERE = $this->_parseArrayPair($where, 'AND');
2236
        } else {
2237
            $WHERE = '';
2238
        }
2239
2240
        if ($databaseName) {
2241
            $databaseName = $this->quote_string(\trim($databaseName)) . '.';
2242
        }
2243
2244
        $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE (${WHERE})";
2245
2246
        return $this->query($sql);
2247
    }
2248
2249
    /**
2250
     * Selects a different database than the one specified on construction.