master

laravel/framework

Last updated at: 29/12/2023 09:24

NullQueue.php

TLDR

This file defines the NullQueue class, which is a subclass of the Queue class and implements the QueueContract interface. It provides methods for managing and manipulating a queue.

Methods

size

This method returns the size of the queue. It accepts an optional parameter $queue which specifies the queue to get the size of. The method returns an integer indicating the size of the queue.

push

This method pushes a new job onto the queue. It accepts the following parameters:

  • $job (string): The job to be pushed onto the queue.
  • $data (mixed): Additional data to be associated with the job. This parameter is optional and defaults to an empty string.
  • $queue (string|null): The queue onto which the job should be pushed. This parameter is optional and defaults to null. The method returns a value that depends on the implementation.

pushRaw

This method pushes a raw payload onto the queue. It accepts the following parameters:

  • $payload (string): The raw payload to be pushed onto the queue.
  • $queue (string|null): The queue onto which the payload should be pushed. This parameter is optional and defaults to null.
  • $options (array): Additional options for pushing the payload onto the queue. This parameter is optional and defaults to an empty array. The method returns a value that depends on the implementation.

later

This method pushes a new job onto the queue after a specified delay. It accepts the following parameters:

  • $delay (\DateTimeInterface|\DateInterval|int): The delay before the job should be pushed onto the queue. This can be specified as a DateTimeInterface instance, a DateInterval instance, or an integer representing the number of seconds.
  • $job (string): The job to be pushed onto the queue.
  • $data (mixed): Additional data to be associated with the job. This parameter is optional and defaults to an empty string.
  • $queue (string|null): The queue onto which the job should be pushed. This parameter is optional and defaults to null. The method returns a value that depends on the implementation.

pop

This method pops the next job off of the queue. It accepts an optional parameter $queue which specifies the queue from which to pop the job. The method returns an instance of the Job class or null if there are no more jobs in the queue.

Classes

NullQueue

This class is a subclass of the Queue class and implements the QueueContract interface. It represents a null queue, which is a queue that does not store any jobs. The NullQueue class provides methods for managing and manipulating a queue.

<?php

namespace Illuminate\Queue;

use Illuminate\Contracts\Queue\Queue as QueueContract;

class NullQueue extends Queue implements QueueContract
{
    /**
     * Get the size of the queue.
     *
     * @param  string|null  $queue
     * @return int
     */
    public function size($queue = null)
    {
        return 0;
    }

    /**
     * Push a new job onto the queue.
     *
     * @param  string  $job
     * @param  mixed  $data
     * @param  string|null  $queue
     * @return mixed
     */
    public function push($job, $data = '', $queue = null)
    {
        //
    }

    /**
     * Push a raw payload onto the queue.
     *
     * @param  string  $payload
     * @param  string|null  $queue
     * @param  array  $options
     * @return mixed
     */
    public function pushRaw($payload, $queue = null, array $options = [])
    {
        //
    }

    /**
     * Push a new job onto the queue after (n) seconds.
     *
     * @param  \DateTimeInterface|\DateInterval|int  $delay
     * @param  string  $job
     * @param  mixed  $data
     * @param  string|null  $queue
     * @return mixed
     */
    public function later($delay, $job, $data = '', $queue = null)
    {
        //
    }

    /**
     * Pop the next job off of the queue.
     *
     * @param  string|null  $queue
     * @return \Illuminate\Contracts\Queue\Job|null
     */
    public function pop($queue = null)
    {
        //
    }
}