src/Entity/Product.php
public function findPriceByCurrency($currency): ?PriceInterface
    {
        if ($currency instanceof \Money\Currency) {
            $currency = $currency->getCode();
        } elseif ($currency instanceof CurrencyInterface) {
            $currency = $currency->getIsoCodeAlpha();
        }

        if (!is_string($currency)) {
            throw new \InvalidArgumentException('$currency has to be a string');
        }

        foreach ($this->prices as $price) {
            if ($price->getCurrency()->getIsoCodeAlpha() === $currency) {
                return $price;
            }
        }

        return null;
    }
public function findPriceByCurrency($currency): ?PriceInterface
    {
        if ($currency instanceof \Money\Currency) {
            $currency = $currency->getCode();
        } elseif ($currency instanceof CurrencyInterface) {
            $currency = $currency->getIsoCodeAlpha();
        }

        if (!is_string($currency)) {
            throw new \InvalidArgumentException('$currency has to be a string');
        }

        foreach ($this->prices as $price) {
            if ($price->getCurrency()->getIsoCodeAlpha() === $currency) {
                return $price;
            }
        }

        return null;
    }
public function findPriceByCurrency ( $ currency ) : ? PriceInterface { if ( $ currency instanceof \ Money \ Currency ) { $ currency = $ currency -> getCode ( ) ; } elseif ( $ currency instanceof CurrencyInterface ) { $ currency = $ currency -> getIsoCodeAlpha ( ) ; } if ( ! is_string ( $ currency ) ) { throw new \ InvalidArgumentException ( '$currency has to be a string' ) ; } foreach ( $ this -> prices as $ price ) { if ( $ price -> getCurrency ( ) -> getIsoCodeAlpha ( ) === $ currency ) { return $ price ; } } return null ; }
Will try to find a price based on currency.

@param string|\Money\Currency|CurrencyInterface $currency

@return PriceInterface|null
Will try to find a price based on currency .