You are here

public function TestSessionListener::onKernelRequest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/EventListener/TestSessionListener.php \Symfony\Component\HttpKernel\EventListener\TestSessionListener::onKernelRequest()

File

vendor/symfony/http-kernel/EventListener/TestSessionListener.php, line 30

Class

TestSessionListener
TestSessionListener.

Namespace

Symfony\Component\HttpKernel\EventListener

Code

public function onKernelRequest(GetResponseEvent $event) {
  if (!$event
    ->isMasterRequest()) {
    return;
  }

  // bootstrap the session
  $session = $this
    ->getSession();
  if (!$session) {
    return;
  }
  $cookies = $event
    ->getRequest()->cookies;
  if ($cookies
    ->has($session
    ->getName())) {
    $session
      ->setId($cookies
      ->get($session
      ->getName()));
  }
}