Ejemplo n.º 1
0
 /**
  * {@inheritDoc}
  *
  * @todo
  */
 public function exchange(Money $money, $targetCurrency)
 {
     if (is_string($targetCurrency)) {
         $targetCurrency = Currency::create($targetCurrency);
     }
     $exchangeRate = 0;
     return $money->exchange($targetCurrency, $exchangeRate);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function setValue($value)
 {
     if ($this->isMultiple()) {
         if ($value instanceof \Traversable) {
             $value = ArrayUtils::iteratorToArray($value);
         } elseif (!$value) {
             return parent::setValue([]);
         } elseif (!is_array($value)) {
             $value = (array) $value;
         }
         return parent::setValue(array_map(Currency::class . '::create', $value));
     }
     return parent::setValue(Currency::create($value));
 }
Ejemplo n.º 3
0
 /**
  * {@inheritDoc}
  */
 public function current()
 {
     return Currency::create($this->getCodes()[$this->position]);
 }