/** * @param Attendee $attendee * @param DateTime $at * * @return float */ public function getCost(Attendee $attendee, DateTime $at) { $cost = $this->getBaseCost($attendee->getEvent(), $attendee->getUser(), $at, $attendee->canAttendTalksDayOnly()); if ($studentDiscount = $this->getStudentDiscount($cost, $attendee)) { $cost -= $studentDiscount; } if ($coupon = $attendee->getDiscount()) { $cost = $coupon->applyDiscountTo($cost); } return $cost; }