Ejemplo n.º 1
0
function testToBTCFunction()
{
    $priceOfDollar = Bitcoin\toBTC('USD', 1);
    $f = floatval($priceOfDollar);
    assertTrue($f > 0);
    // assertEqual(floatval($priceOfDollar), floatval(strval($priceOfDollar)));
}
Ejemplo n.º 2
0
 public function updateBalance(Bitcoin\AmountOfBitcoin $balance)
 {
     $this->raisedSatoshis = $balance->numSatoshis;
     $this->raisedBTC = $balance->numBTC;
     $raisedInBaseCurrency = $this->currency == 'BTC' ? $this->raisedBTC : Bitcoin\fromBTC($this->raisedBTC, $this->currency);
     $this->raisedAmnt = new Amount($this->currency, $raisedInBaseCurrency);
     $goalInBTC = $this->currency == 'BTC' ? $this->goalAmnt->numUnits : Bitcoin\toBTC($this->currency, $this->goalAmnt->numUnits);
     $this->progressPercent = $this->raisedBTC / $goalInBTC * 100;
     if ($this->progressPercent > 100) {
         $this->progressPercent = 100;
     }
 }
Ejemplo n.º 3
0
 private function setAltCurrencyValues(Amount $goal, Amount $raised, array &$vars)
 {
     if ($goal->currencyCode == "BTC") {
         $vars['altGoal'] = $this->btcToDollars($goal->numUnits);
         $vars['altRaised'] = $this->btcToDollars($raised->numUnits);
     } else {
         $goalInBTC = Bitcoin\toBTC($goal->currencyCode, $goal->numUnits);
         $vars['altGoal'] = new Amount('BTC', $goalInBTC);
         //Currency\displayAmount($goalInBTC, 'BTC');
         $raisedInBTC = Bitcoin\toBTC($raised->currencyCode, $raised->numUnits);
         $vars['altRaised'] = new Amount('BTC', $raisedInBTC);
         //Currency\displayAmount($raisedInBTC, 'BTC');
     }
 }