public function transform($coupon) { if (null === $coupon) { return ''; } if (!$coupon instanceof PromotionCouponInterface) { throw new UnexpectedTypeException($coupon, PromotionCouponInterface::class); } return $coupon->getCode(); }