Abstract Class Yiisoft\Queue\Middleware\MiddlewareFactory
Protected Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $container | \ |
Yiisoft\ |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
Protected Methods
Property Details
Method Details
| public mixed __construct ( \ | ||
| $container | \ |
Container used to resolve middleware. |
| $callableDependencyContainer | \ |
Container used to resolve callable middleware dependencies. If not set, the main container is used. |
public function __construct(
protected readonly ContainerInterface $container,
?ContainerInterface $callableDependencyContainer = null,
) {
$this->callableFactory = new CallableFactory($container, $callableDependencyContainer);
}
| protected \ | ||
| $definition | callable|array|string |
Middleware definition in one of the following formats: |
| return | \ |
Middleware instance |
|---|---|---|
| throws | Yiisoft\ |
|
protected function create(callable|array|string $definition): object
{
try {
$callable = $this->callableFactory->create($definition);
return $this->wrapMiddleware($callable);
} catch (InvalidCallableConfigurationException) {
// Not a callable, try internal checks
}
if (is_string($definition)) {
return $this->getFromContainer($definition);
}
if (is_array($definition)) {
return $this->tryGetFromArrayDefinition($definition)
?? throw new InvalidMiddlewareDefinitionException($definition);
}
throw new InvalidMiddlewareDefinitionException($definition);
}
| protected abstract class-string<\Yiisoft\Queue\Middleware\T> getInterfaceName ( ) | ||
| return | class-string<\Yiisoft\Queue\Middleware\T> |
Required interface FQCN |
|---|---|---|
abstract protected function getInterfaceName(): string;
| protected abstract \ | ||
| $callback | callable |
Callable to wrap |
| return | \ |
Wrapped middleware |
|---|---|---|
abstract protected function wrapMiddleware(callable $callback): object;
User Contributed Notes
Leave a comment
Join the conversation to share a note.