Code Duplication    Length = 14-14 lines in 2 locations

src/db/drivers/MysqlDriver.php 1 location

@@ 216-229 (lines=14) @@
213
     *
214
     * @return bool
215
     */
216
    public function exists($table, array $params = [])
217
    {
218
        $keys = [];
219
220
        foreach ($params AS $key => $val) {
221
            $keys[] = '`'.$key.'`="'.$val.'""';
222
        }
223
224
        $sth = $this->conn->prepare('SELECT * FROM '.$table.' WHERE '.implode(' AND ', $keys).' LIMIT 1;');
225
        /** @noinspection PdoApiUsageInspection */
226
        $sth->execute();
227
228
        return (bool)$sth->rowCount();
229
    }
230
}
231

src/db/drivers/PgsqlDriver.php 1 location

@@ 224-237 (lines=14) @@
221
     *
222
     * @return bool
223
     */
224
    public function exists($table, array $params = [])
225
    {
226
        $keys = [];
227
228
        foreach ($params AS $key => $val) {
229
            $keys[] = '"'.$key.'"=\''.$val.'\'';
230
        }
231
232
        $sth = $this->conn->prepare('SELECT * FROM '.$table.' WHERE '.implode(' AND ', $keys).' LIMIT 1;');
233
        /** @noinspection PdoApiUsageInspection */
234
        $sth->execute();
235
236
        return (bool)$sth->rowCount();
237
    }
238
}