Code Duplication    Length = 21-23 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 1624-1646 (lines=23) @@
1621
   *
1622
   * @return false|int false on error
1623
   */
1624
  public function delete($table, $where)
1625
  {
1626
1627
    $table = trim($table);
1628
1629
    if ($table === '') {
1630
      $this->_displayError('invalid table name');
1631
1632
      return false;
1633
    }
1634
1635
    if (is_string($where)) {
1636
      $WHERE = $this->escape($where, false, false);
1637
    } elseif (is_array($where)) {
1638
      $WHERE = $this->_parseArrayPair($where, 'AND');
1639
    } else {
1640
      $WHERE = '';
1641
    }
1642
1643
    $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1644
1645
    return $this->query($sql);
1646
  }
1647
1648
  /**
1649
   * Execute a "select"-query.
@@ 1656-1676 (lines=21) @@
1653
   *
1654
   * @return false|Result false on error
1655
   */
1656
  public function select($table, $where = '1=1')
1657
  {
1658
1659
    if ($table === '') {
1660
      $this->_displayError('invalid table name');
1661
1662
      return false;
1663
    }
1664
1665
    if (is_string($where)) {
1666
      $WHERE = $this->escape($where, false, false);
1667
    } elseif (is_array($where)) {
1668
      $WHERE = $this->_parseArrayPair($where, 'AND');
1669
    } else {
1670
      $WHERE = '';
1671
    }
1672
1673
    $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1674
1675
    return $this->query($sql);
1676
  }
1677
1678
  /**
1679
   * Get the last sql-error.