Code Duplication    Length = 21-23 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 1336-1358 (lines=23) @@
1333
   *
1334
   * @return false|int false on error
1335
   */
1336
  public function delete($table, $where)
1337
  {
1338
1339
    $table = trim($table);
1340
1341
    if ($table === '') {
1342
      $this->_debug->displayError('invalid table name');
1343
1344
      return false;
1345
    }
1346
1347
    if (is_string($where)) {
1348
      $WHERE = $this->escape($where, false, false);
1349
    } elseif (is_array($where)) {
1350
      $WHERE = $this->_parseArrayPair($where, 'AND');
1351
    } else {
1352
      $WHERE = '';
1353
    }
1354
1355
    $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1356
1357
    return $this->query($sql);
1358
  }
1359
1360
  /**
1361
   * Execute a "select"-query.
@@ 1368-1388 (lines=21) @@
1365
   *
1366
   * @return false|Result false on error
1367
   */
1368
  public function select($table, $where = '1=1')
1369
  {
1370
1371
    if ($table === '') {
1372
      $this->_debug->displayError('invalid table name');
1373
1374
      return false;
1375
    }
1376
1377
    if (is_string($where)) {
1378
      $WHERE = $this->escape($where, false, false);
1379
    } elseif (is_array($where)) {
1380
      $WHERE = $this->_parseArrayPair($where, 'AND');
1381
    } else {
1382
      $WHERE = '';
1383
    }
1384
1385
    $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1386
1387
    return $this->query($sql);
1388
  }
1389
1390
  /**
1391
   * Get the last sql-error.