You are here

public static function LTIToolProviderController::create in LTI Tool Provider 2.x

Same name and namespace in other branches
  1. 8 src/Controller/LTIToolProviderController.php \Drupal\lti_tool_provider\Controller\LTIToolProviderController::create()

Instantiates a new instance of this class.

This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.

Parameters

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

Overrides ControllerBase::create

File

src/Controller/LTIToolProviderController.php, line 127

Class

LTIToolProviderController
Returns responses for lti_tool_provider module routes.

Namespace

Drupal\lti_tool_provider\Controller

Code

public static function create(ContainerInterface $container) : LTIToolProviderController {

  /* @var $configFactory ConfigFactoryInterface */
  $configFactory = $container
    ->get('config.factory');

  /* @var $loggerFactory LoggerChannelFactoryInterface */
  $loggerFactory = $container
    ->get('logger.factory');

  /* @var $eventDispatcher EventDispatcherInterface */
  $eventDispatcher = $container
    ->get('event_dispatcher');

  /* @var $killSwitch ResponsePolicyInterface */
  $killSwitch = $container
    ->get('page_cache_kill_switch');
  $request = Drupal::request();
  $session = $request
    ->getSession();
  $context = $session
    ->get('lti_tool_provider_context');
  $destination = Drupal::config('lti_tool_provider.settings')
    ->get('destination');
  return new static($configFactory, $loggerFactory, $eventDispatcher, $killSwitch, $request, $session, $context, $destination);
}