Definition at line 32 of file Injector.php.
◆ __construct()
ILIAS\BackgroundTasks\Dependencies\Injector::__construct |
( |
protected Container |
$dic, |
|
|
protected DependencyMap |
$dependencyMap |
|
) |
| |
Factory constructor.
- Parameters
-
Definition at line 38 of file Injector.php.
◆ createConstructorArguments()
ILIAS\BackgroundTasks\Dependencies\Injector::createConstructorArguments |
( |
string |
$fullyQualifiedClassName, |
|
|
array |
$parameters, |
|
|
?callable |
$with |
|
) |
| |
|
protected |
◆ createInstance()
ILIAS\BackgroundTasks\Dependencies\Injector::createInstance |
( |
string |
$fullyQualifiedClassName, |
|
|
bool |
$requireFile = false , |
|
|
?callable |
$with = null |
|
) |
| |
- Parameters
-
string | $fullyQualifiedClassName | The given class must type hint all its constructor arguments. Furthermore the types must exist in the DI-Container. |
Definition at line 47 of file Injector.php.
References ILIAS\BackgroundTasks\Dependencies\Injector\createConstructorArguments(), and null.
53 $reflectionClass = new \ReflectionClass($fullyQualifiedClassName);
54 $constructor = $reflectionClass->getConstructor();
55 if ($constructor ===
null) {
56 return $reflectionClass->newInstance();
59 $parameters = $constructor->getParameters();
65 return $reflectionClass->newInstanceArgs($constructorArguments);
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
createConstructorArguments(string $fullyQualifiedClassName, array $parameters, ?callable $with)
◆ getDependency()
ILIAS\BackgroundTasks\Dependencies\Injector::getDependency |
( |
string |
$fullyQualifiedClassName, |
|
|
ReflectionParameter |
$parameter, |
|
|
?callable |
$with = null |
|
) |
| |
|
protected |
- Exceptions
-
Definition at line 89 of file Injector.php.
Referenced by ILIAS\BackgroundTasks\Dependencies\Injector\createConstructorArguments().
100 $type = $parameter->getClass()->getName();
107 throw new InvalidClassException(
"The DI cannot instantiate $fullyQualifiedClassName because some of the constructors arguments are not type hinted. Make sure all parameters in the constructor have type hinting.");
111 return $this->dependencyMap->getDependencyWith($this->dic, $type, $fullyQualifiedClassName, $with);
113 return $this->dependencyMap->getDependency($this->dic, $type, $fullyQualifiedClassName);
The documentation for this class was generated from the following file:
- components/ILIAS/BackgroundTasks/src/Dependencies/Injector.php