Final Class Yiisoft\Queue\Middleware\CallableFactory
| Inheritance | Yiisoft\ |
|---|
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| create() | Create a real callable listener from definition. Calling the returned callable invokes the resolved listener, injecting its dependencies by type hinting. | Yiisoft\ |
Method Details
| public mixed __construct ( \ | ||
| $container | \ |
|
| $dependencyContainer | ?\ |
|
public function __construct(
private readonly ContainerInterface $container,
?ContainerInterface $dependencyContainer = null,
) {
$this->injector = new Injector($dependencyContainer ?? $container);
}
Create a real callable listener from definition. Calling the returned callable invokes the resolved listener, injecting its dependencies by type hinting.
| public callable create ( mixed $definition ) | ||
| $definition | mixed |
Definition to create listener from. |
| throws | Yiisoft\ |
Failed to create listener. |
|---|---|---|
| throws | \ |
Error while retrieving the entry from container. |
public function create(mixed $definition): callable
{
$callable = $this->resolve($definition);
return fn(mixed ...$params): mixed => $this->injector->invoke($callable, $params);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.