original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Will try to find a price based on currency.
  
  @param string|\Money\Currency|CurrencyInterface $currency
  
  @return PriceInterface|null
docstring_tokens: Will try to find a price based on currency .