Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SessionValueResolver.php

function SessionValueResolver::resolve

Overrides ValueResolverInterface::resolve

File

vendor/symfony/http-kernel/Controller/ArgumentResolver/SessionValueResolver.php, line 26

Class

SessionValueResolver
Yields the Session.

Namespace

Symfony\Component\HttpKernel\Controller\ArgumentResolver

Code

public function resolve(Request $request, ArgumentMetadata $argument) : array {
    if (!$request->hasSession()) {
        return [];
    }
    $type = $argument->getType();
    if (SessionInterface::class !== $type && !is_subclass_of($type, SessionInterface::class)) {
        return [];
    }
    return $request->getSession() instanceof $type ? [
        $request->getSession(),
    ] : [];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal