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.
@@ 2224-2250 (lines=27) @@
2221
     *
2222
     * @return false|Result <p>false on error</p>
2223
     */
2224
    public function select(string $table, $where = '1=1', string $databaseName = null)
2225
    {
2226
        // init
2227
        $table = \trim($table);
2228
2229
        if ($table === '') {
2230
            $this->debug->displayError('Invalid table name, table name in empty.', false);
2231
2232
            return false;
2233
        }
2234
2235
        if (\is_string($where)) {
2236
            $WHERE = $this->escape($where, false);
2237
        } elseif (\is_array($where)) {
2238
            $WHERE = $this->_parseArrayPair($where, 'AND');
2239
        } else {
2240
            $WHERE = '';
2241
        }
2242
2243
        if ($databaseName) {
2244
            $databaseName = $this->quote_string(\trim($databaseName)) . '.';
2245
        }
2246
2247
        $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE (${WHERE})";
2248
2249
        return $this->query($sql);
2250
    }
2251
2252
    /**
2253
     * Selects a different database than the one specified on construction.