You are here

public function ClassResolverInterface::getInstanceFromDefinition in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/DependencyInjection/ClassResolverInterface.php \Drupal\Core\DependencyInjection\ClassResolverInterface::getInstanceFromDefinition()

Returns a class instance with a given class definition.

In contrast to controllers you don't specify a method.

Parameters

string $definition: A class name or service name.

Return value

object The instance of the class.

Throws

\InvalidArgumentException If $class is not a valid service identifier and the class does not exist.

1 method overrides ClassResolverInterface::getInstanceFromDefinition()
ClassResolver::getInstanceFromDefinition in core/lib/Drupal/Core/DependencyInjection/ClassResolver.php
Returns a class instance with a given class definition.

File

core/lib/Drupal/Core/DependencyInjection/ClassResolverInterface.php, line 29
Contains \Drupal\Core\DependencyInjection\ClassResolverInterface.

Class

ClassResolverInterface
Provides an interface to get a instance of a class with dependency injection.

Namespace

Drupal\Core\DependencyInjection

Code

public function getInstanceFromDefinition($definition);