Code Duplication    Length = 21-23 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 1589-1611 (lines=23) @@
1586
   *
1587
   * @return false|int false on error
1588
   */
1589
  public function delete($table, $where)
1590
  {
1591
1592
    $table = trim($table);
1593
1594
    if ($table === '') {
1595
      $this->_displayError('invalid table name');
1596
1597
      return false;
1598
    }
1599
1600
    if (is_string($where)) {
1601
      $WHERE = $this->escape($where, false, false);
1602
    } elseif (is_array($where)) {
1603
      $WHERE = $this->_parseArrayPair($where, 'AND');
1604
    } else {
1605
      $WHERE = '';
1606
    }
1607
1608
    $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1609
1610
    return $this->query($sql);
1611
  }
1612
1613
  /**
1614
   * select
@@ 1621-1641 (lines=21) @@
1618
   *
1619
   * @return false|Result false on error
1620
   */
1621
  public function select($table, $where = '1=1')
1622
  {
1623
1624
    if ($table === '') {
1625
      $this->_displayError('invalid table name');
1626
1627
      return false;
1628
    }
1629
1630
    if (is_string($where)) {
1631
      $WHERE = $this->escape($where, false, false);
1632
    } elseif (is_array($where)) {
1633
      $WHERE = $this->_parseArrayPair($where, 'AND');
1634
    } else {
1635
      $WHERE = '';
1636
    }
1637
1638
    $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1639
1640
    return $this->query($sql);
1641
  }
1642
1643
  /**
1644
   * get the last error