0 follower

Final Class Yiisoft\Queue\Provider\QueueFactoryProvider

InheritanceYiisoft\Queue\Provider\QueueFactoryProvider
ImplementsYiisoft\Queue\Provider\QueueProviderInterface

This queue provider creates queue objects directly from definitions.

See also:

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( array $definitions, \Psr\Container\ContainerInterface|null $container null, boolean $validate true )
$definitions array

Queue definitions indexed by queue names.

$container \Psr\Container\ContainerInterface|null

Container to use for dependencies resolving.

$validate boolean

If definitions should be validated when set.

throws Yiisoft\Queue\Provider\InvalidQueueConfigException

                public function __construct(
    array $definitions,
    ?ContainerInterface $container = null,
    bool $validate = true,
) {
    $this->names = array_keys($definitions);
    try {
        $this->factory = new StrictFactory($definitions, $container, $validate);
    } catch (InvalidConfigException $exception) {
        throw new InvalidQueueConfigException($exception->getMessage(), previous: $exception);
    }
}

            
get() public method

public Yiisoft\Queue\QueueInterface get ( string|\BackedEnum $name )
$name string|\BackedEnum

                public function get(string|BackedEnum $name): QueueInterface
{
    $name = StringNormalizer::normalize($name);
    $queue = $this->getOrTryToCreate($name);
    if ($queue === null) {
        throw new QueueNotFoundException($name);
    }
    return $queue;
}

            
getNames() public method

public array getNames ( )

                public function getNames(): array
{
    return $this->names;
}

            
has() public method

public boolean has ( string|\BackedEnum $name )
$name string|\BackedEnum

                public function has(string|BackedEnum $name): bool
{
    $name = StringNormalizer::normalize($name);
    return $this->factory->has($name);
}