Final Class Yiisoft\Queue\Provider\PredefinedQueueProvider
| Inheritance | Yiisoft\Queue\Provider\PredefinedQueueProvider |
|---|---|
| Implements | Yiisoft\Queue\Provider\QueueProviderInterface |
Queue provider that uses a pre-defined map of queue name to queue instance.
Public Methods
Method Details
| public mixed __construct ( array $queues ) | ||
| $queues | array |
Map of queue name to queue instance. |
| throws | Yiisoft\Queue\Provider\InvalidQueueConfigException |
If a value in the array is not a {@see \Yiisoft\Queue\QueueInterface} instance. |
|---|---|---|
public function __construct(array $queues)
{
foreach ($queues as $name => $queue) {
if (!$queue instanceof QueueInterface) {
throw new InvalidQueueConfigException(
sprintf(
'Queue must implement "%s". For queue "%s" got "%s" instead.',
QueueInterface::class,
$name,
get_debug_type($queue),
),
);
}
}
$this->queues = $queues;
}
| public Yiisoft\Queue\QueueInterface get ( string|\BackedEnum $name ) | ||
| $name | string|\BackedEnum | |
public function get(string|BackedEnum $name): QueueInterface
{
$name = StringNormalizer::normalize($name);
if (!array_key_exists($name, $this->queues)) {
throw new QueueNotFoundException($name);
}
return $this->queues[$name];
}
Signup or Login in order to comment.