function SwitchUserController::create

Instantiates a new instance of the implementing class using autowiring.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The service container this instance should use.

Return value

static

Overrides AutowireTrait::create

File

src/Controller/SwitchUserController.php, line 41

Class

SwitchUserController
Controller for switch to another user account.

Namespace

Drupal\devel\Controller

Code

public static function create(ContainerInterface $container) : static {
  $instance = parent::create($container);
  $instance->account = $container->get('current_user');
  $instance->userStorage = $container->get('entity_type.manager')
    ->getStorage('user');
  $instance->moduleHandler = $container->get('module_handler');
  $instance->sessionManager = $container->get('session_manager');
  $instance->session = $container->get('session');
  return $instance;
}