Code Duplication    Length = 21-23 lines in 2 locations

src/voku/db/DB.php 2 locations

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