Code Duplication    Length = 20-20 lines in 2 locations

include/classes/coin_address.class.php 2 locations

@@ 23-42 (lines=20) @@
20
   * @param userID int UserID
21
   * @return data string Coin Address
22
   **/
23
  public function getCoinAddress($userID, $currency=NULL) {
24
    if ($currency === NULL) $currency = $this->config['currency'];
25
    $this->debug->append("STA " . __METHOD__, 4);
26
    $stmt = $this->mysqli->prepare("
27
      SELECT coin_address
28
      FROM " . $this->getTableName() . "
29
      WHERE account_id = ? AND currency = ?
30
      ");
31
    if ( $this->checkStmt($stmt) && $stmt->bind_param('is', $userID, $currency) && $stmt->execute() && $result = $stmt->get_result()) {
32
      if ($result->num_rows == 1) {
33
        return $result->fetch_object()->coin_address;
34
      }
35
    }
36
    $this->debug->append("Unable to fetch users coin address for " . $currency);
37
    return $this->sqlError();
38
  }
39
40
  /**
41
   * Fetch users Auto Payout Threshold for a currency
42
   * @param UserID int UserID
43
   * @return mixed Float value for threshold, false on error
44
   **/
45
  public function getAPThreshold($userID, $currency=NULL) {
@@ 45-64 (lines=20) @@
42
   * @param UserID int UserID
43
   * @return mixed Float value for threshold, false on error
44
   **/
45
  public function getAPThreshold($userID, $currency=NULL) {
46
    if ($currency === NULL) $currency = $this->config['currency'];
47
    $this->debug->append("STA " . __METHOD__, 4);
48
    $stmt = $this->mysqli->prepare("
49
      SELECT ap_threshold
50
      FROM " . $this->getTableName() . "
51
      WHERE account_id = ? AND currency = ?
52
      ");
53
    if ( $this->checkStmt($stmt) && $stmt->bind_param('is', $userID, $currency) && $stmt->execute() && $result = $stmt->get_result()) {
54
      if ($result->num_rows == 1) {
55
        return $result->fetch_object()->ap_threshold;
56
      }
57
    }
58
    $this->debug->append("Unable to fetch users auto payout threshold for " . $currency);
59
    return $this->sqlError();
60
  }
61
62
63
  /**
64
   * Check if a coin address is already set
65
   * @param address string Coin Address to check for
66
   * @return bool true or false
67
   **/