/** * @param \Ilis\Bundle\PaymentBundle\Entity\Transaction\Paypal $transaction * @throws Exception * @return string */ public function buildUrl(PaypalTransaction $transaction) { switch ($transaction->getType()) { case PaypalTransaction::TYPE_BUYNOW: return $this->buildBuyNowUrl($transaction); break; default: throw new Exception(sprintf('Unhandled transaction type "%s"', $transaction->getType())); } }