コード例 #1
0
ファイル: CnbDay.php プロジェクト: rokerkony/Exchange
 /**
  * download resource
  * @return string
  */
 public function downloading()
 {
     $data = \explode("\n", parent::stroke2point(trim($this->getData())));
     $data[0] = explode(' #', $data[0]);
     $data[1] = self::CNB_CZK;
     $this->save($data);
 }
コード例 #2
0
ファイル: Exchange.php プロジェクト: rokerkony/Exchange
 /**
  * transfer number by exchange rate
  * @param double|int|string $price number
  * @param string $from default currency
  * @param string $to output currency
  * @param int $round number round
  * @return double
  */
 public function change($price, $from = FALSE, $to = FALSE, $round = FALSE)
 {
     if (is_string($price)) {
         $price = (double) Download::stroke2point($price);
     }
     $from = !$from ? $this->default : $this->loadCurrency($from);
     $to = !$to ? $this->web : $this->loadCurrency($to);
     $price = $this[$to][self::RATE] / $this[$from][self::RATE] * $price;
     if ($round !== FALSE) {
         $price = round($price, $round);
     }
     return $price;
 }