getSession()->set(self::LAST_STARTED_KEY, $flow->value); } public function resolvePending(Request $request): ?PurchaseFlow { $session = $request->getSession(); $hasBooking = $session->has(BookingSessionManager::BOOKING_CREATE_KEY); $hasVoucher = $session->has(VoucherPurchaseSessionManager::SESSION_KEY); if (true === $hasBooking && true === $hasVoucher) { return PurchaseFlow::tryFrom((string) $session->get(self::LAST_STARTED_KEY)) ?? PurchaseFlow::Booking; } return match (true) { $hasBooking => PurchaseFlow::Booking, $hasVoucher => PurchaseFlow::Voucher, default => null, }; } }