PHP 8.3.31
Preview: QueuedClosure.php Size: 2.74 KB
/home/getspomw/royalsquad.us/vendor/laravel/framework/src/Illuminate/Events/QueuedClosure.php

<?php

namespace Illuminate\Events;

use Closure;
use Illuminate\Support\Collection;
use Laravel\SerializableClosure\SerializableClosure;

use function Illuminate\Support\enum_value;

class QueuedClosure
{
    /**
     * The underlying Closure.
     *
     * @var \Closure
     */
    public $closure;

    /**
     * The name of the connection the job should be sent to.
     *
     * @var string|null
     */
    public $connection;

    /**
     * The name of the queue the job should be sent to.
     *
     * @var string|null
     */
    public $queue;

    /**
     * The number of seconds before the job should be made available.
     *
     * @var \DateTimeInterface|\DateInterval|int|null
     */
    public $delay;

    /**
     * All of the "catch" callbacks for the queued closure.
     *
     * @var array
     */
    public $catchCallbacks = [];

    /**
     * Create a new queued closure event listener resolver.
     *
     * @param  \Closure  $closure
     * @return void
     */
    public function __construct(Closure $closure)
    {
        $this->closure = $closure;
    }

    /**
     * Set the desired connection for the job.
     *
     * @param  string|null  $connection
     * @return $this
     */
    public function onConnection($connection)
    {
        $this->connection = $connection;

        return $this;
    }

    /**
     * Set the desired queue for the job.
     *
     * @param  \BackedEnum|string|null  $queue
     * @return $this
     */
    public function onQueue($queue)
    {
        $this->queue = enum_value($queue);

        return $this;
    }

    /**
     * Set the desired delay in seconds for the job.
     *
     * @param  \DateTimeInterface|\DateInterval|int|null  $delay
     * @return $this
     */
    public function delay($delay)
    {
        $this->delay = $delay;

        return $this;
    }

    /**
     * Specify a callback that should be invoked if the queued listener job fails.
     *
     * @param  \Closure  $closure
     * @return $this
     */
    public function catch(Closure $closure)
    {
        $this->catchCallbacks[] = $closure;

        return $this;
    }

    /**
     * Resolve the actual event listener callback.
     *
     * @return \Closure
     */
    public function resolve()
    {
        return function (...$arguments) {
            dispatch(new CallQueuedListener(InvokeQueuedClosure::class, 'handle', [
                'closure' => new SerializableClosure($this->closure),
                'arguments' => $arguments,
                'catch' => (new Collection($this->catchCallbacks))
                    ->map(fn ($callback) => new SerializableClosure($callback))
                    ->all(),
            ]))->onConnection($this->connection)->onQueue($this->queue)->delay($this->delay);
        };
    }
}

Directory Contents

Dirs: 0 × Files: 9

Name Size Perms Modified Actions
3.80 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
1.01 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
21.87 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
761 B lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
362 B lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
876 B lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
1.05 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
3.04 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download
2.74 KB lrw-rw-rw- 2025-09-17 06:52:58
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).