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

Breadcrumb

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

class SessionValueResolver

Yields the Session.

@author Iltar van der Berg <kjarli@gmail.com>

Hierarchy

  • class \Symfony\Component\HttpKernel\Controller\ArgumentResolver\SessionValueResolver implements \Symfony\Component\HttpKernel\Controller\ValueResolverInterface

Expanded class hierarchy of SessionValueResolver

1 file declares its use of SessionValueResolver
ArgumentResolver.php in vendor/symfony/http-kernel/Controller/ArgumentResolver.php

File

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

Namespace

Symfony\Component\HttpKernel\Controller\ArgumentResolver
View source
final class SessionValueResolver implements ValueResolverInterface {
    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(),
        ] : [];
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
SessionValueResolver::resolve public function Returns the possible value(s). Overrides ValueResolverInterface::resolve

API Navigation

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