currencies as $currencies) { if ($currencies->contains($currency)) { return true; } } return false; } public function subunitFor(Currency $currency): int { foreach ($this->currencies as $currencies) { if ($currencies->contains($currency)) { return $currencies->subunitFor($currency); } } throw new UnknownCurrencyException('Cannot find currency ' . $currency->getCode()); } /** {@inheritDoc} */ public function getIterator(): Traversable { $iterator = new AppendIterator(); foreach ($this->currencies as $currencies) { $iterator->append(new IteratorIterator($currencies->getIterator())); } return $iterator; } }