function RestExampleClientController::create

Same name and namespace in other branches
  1. 3.x modules/rest_example/src/Controller/RestExampleClientController.php \Drupal\rest_example\Controller\RestExampleClientController::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 ContainerInjectionInterface::create

File

modules/rest_example/src/Controller/RestExampleClientController.php, line 60

Class

RestExampleClientController
Controller class for the REST Example routes.

Namespace

Drupal\rest_example\Controller

Code

public static function create(ContainerInterface $container) {
    $controller = new static($container->get('config.factory'), $container->get('rest_example_client_calls'));
    $controller->setMessenger($container->get('messenger'));
    $controller->setStringTranslation($container->get('string_translation'));
    return $controller;
}