3 namespace Drupal\Core\DependencyInjection;
5 use Symfony\Component\DependencyInjection\ContainerInterface;
8 * Defines a common interface for dependency container injection.
10 * This interface gives classes who need services a factory method for
11 * instantiation rather than defining a new service.
13 interface ContainerInjectionInterface {
16 * Instantiates a new instance of this class.
18 * This is a factory method that returns a new instance of this class. The
19 * factory should pass any needed dependencies into the constructor of this
20 * class, but not the container itself. Every call to this method must return
21 * a new instance of this class; that is, it may not implement a singleton.
23 * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
24 * The service container this instance should use.
26 public static function create(ContainerInterface $container);