ClassResolverInterface.php 632 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace Drupal\Core\DependencyInjection;
  3. /**
  4. * Provides an interface to get a instance of a class with dependency injection.
  5. */
  6. interface ClassResolverInterface {
  7. /**
  8. * Returns a class instance with a given class definition.
  9. *
  10. * In contrast to controllers you don't specify a method.
  11. *
  12. * @param string $definition
  13. * A class name or service name.
  14. *
  15. * @return object
  16. * The instance of the class.
  17. *
  18. * @throws \InvalidArgumentException
  19. * If $class is not a valid service identifier and the class does not exist.
  20. */
  21. public function getInstanceFromDefinition($definition);
  22. }