private function forceWrappedSessionInitialization() { // no-op operation that is known to trigger session lazy-loading $this->lazySession->remove(uniqid('nonExisting', true)); }
/** * {@inheritdoc} * * @throws \InvalidArgumentException * @throws \OutOfBoundsException */ public function __invoke(Request $request, Response $response, callable $out = null) : Response { $token = $this->parseToken($request); $sessionContainer = LazySession::fromContainerBuildingCallback(function () use($token) : SessionInterface { return $this->extractSessionContainer($token); }); if (null !== $out) { $response = $out($request->withAttribute(self::SESSION_ATTRIBUTE, $sessionContainer), $response); } return $this->appendToken($sessionContainer, $response, $token); }