class QueueRoutes (View source)

Traits

Properties

protected array<class-string, array|string> $routes

The mapping of class names to their default routes.

protected array<string, array> $forwards

The queues that have been forwarded to another queue and/or connection.

Methods

mixed
getAttributeValue(object $target, string $attributeClass, string|null $property = null, mixed $default = null)

Get a configuration value from an attribute, falling back to a property.

mixed
extractAttributeValue(object $instance)

Extract the value from an attribute instance.

object|null
getAttributeInstance(object $target, string $attributeClass, ReflectionClass|null $declaringClass = null)

Get an instance of the given attribute class from the target class or its parents.

bool
propertyOverridesAttribute(object $target, ReflectionClass $reflection, string|null $property, ReflectionClass $attributeDeclaringClass)

Determine if a property declared on a child class overrides an inherited attribute.

string|null
getConnection(object $queueable)

Get the queue connection that a given queueable instance should be routed to.

string|null
forwardedConnection(UnitEnum|string|null $queue)

Get the connection the given queue has been forwarded to.

string|null
getQueue(object $queueable)

Get the queue that a given queueable instance should be routed to.

string
forwardedQueue(string $queue, string|null $connection = null)

Get the queue the given queue has been forwarded to.

array|string|null
getRoute(object $queueable)

Get the route for a given queueable instance.

void
set(array|string $class, UnitEnum|string|null $queue = null, UnitEnum|string|null $connection = null)

Register the queue route for the given class.

void
forward(UnitEnum|array|string $queue, UnitEnum|string|null $to = null, UnitEnum|string|null $connection = null)

Register a forward for the given queue.

array<class-string, array|string>
all()

Get all registered queue routes.

Details

protected mixed getAttributeValue(object $target, string $attributeClass, string|null $property = null, mixed $default = null)

Get a configuration value from an attribute, falling back to a property.

Parameters

object $target
string $attributeClass
string|null $property
mixed $default

Return Value

mixed

protected mixed extractAttributeValue(object $instance)

Extract the value from an attribute instance.

Parameters

object $instance

Return Value

mixed

protected object|null getAttributeInstance(object $target, string $attributeClass, ReflectionClass|null $declaringClass = null)

Get an instance of the given attribute class from the target class or its parents.

Parameters

object $target
string $attributeClass
ReflectionClass|null $declaringClass

Return Value

object|null

protected bool propertyOverridesAttribute(object $target, ReflectionClass $reflection, string|null $property, ReflectionClass $attributeDeclaringClass)

Determine if a property declared on a child class overrides an inherited attribute.

Parameters

object $target
ReflectionClass $reflection
string|null $property
ReflectionClass $attributeDeclaringClass

Return Value

bool

string|null getConnection(object $queueable)

Get the queue connection that a given queueable instance should be routed to.

Parameters

object $queueable

Return Value

string|null

protected string|null forwardedConnection(UnitEnum|string|null $queue)

Get the connection the given queue has been forwarded to.

Parameters

UnitEnum|string|null $queue

Return Value

string|null

string|null getQueue(object $queueable)

Get the queue that a given queueable instance should be routed to.

Parameters

object $queueable

Return Value

string|null

string forwardedQueue(string $queue, string|null $connection = null)

Get the queue the given queue has been forwarded to.

Parameters

string $queue
string|null $connection

Return Value

string

array|string|null getRoute(object $queueable)

Get the route for a given queueable instance.

Parameters

object $queueable

Return Value

array|string|null

void set(array|string $class, UnitEnum|string|null $queue = null, UnitEnum|string|null $connection = null)

Register the queue route for the given class.

Parameters

array|string $class
UnitEnum|string|null $queue
UnitEnum|string|null $connection

Return Value

void

void forward(UnitEnum|array|string $queue, UnitEnum|string|null $to = null, UnitEnum|string|null $connection = null)

Register a forward for the given queue.

Parameters

UnitEnum|array|string $queue
UnitEnum|string|null $to
UnitEnum|string|null $connection

Return Value

void

array<class-string, array|string> all()

Get all registered queue routes.

Return Value

array<class-string, array|string>