master

laravel/framework

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

NullFailedJobProvider.php

TLDR

This file contains the NullFailedJobProvider class, which implements the CountableFailedJobProvider and FailedJobProviderInterface interfaces. It provides methods to log, retrieve, delete, and count failed jobs.

Methods

log

This method logs a failed job into storage. It accepts the parameters $connection (string), $queue (string), $payload (string), and $exception (\Throwable). It returns an integer or null.

ids

This method retrieves the IDs of all failed jobs. It accepts an optional parameter $queue (string|null). It returns an array.

all

This method retrieves a list of all failed jobs. It does not accept any parameters. It returns an array.

find

This method retrieves a single failed job. It accepts the parameter $id (mixed). It returns an object or null.

forget

This method deletes a single failed job from storage. It accepts the parameter $id (mixed). It returns a boolean indicating the success of the operation.

flush

This method flushes all failed jobs from storage. It accepts an optional parameter $hours (int|null).

count

This method counts the number of failed jobs. It accepts the optional parameters $connection (string|null) and $queue (string|null). It returns an integer.

<?php

namespace Illuminate\Queue\Failed;

class NullFailedJobProvider implements CountableFailedJobProvider, FailedJobProviderInterface
{
    /**
     * Log a failed job into storage.
     *
     * @param  string  $connection
     * @param  string  $queue
     * @param  string  $payload
     * @param  \Throwable  $exception
     * @return int|null
     */
    public function log($connection, $queue, $payload, $exception)
    {
        //
    }

    /**
     * Get the IDs of all of the failed jobs.
     *
     * @param  string|null  $queue
     * @return array
     */
    public function ids($queue = null)
    {
        return [];
    }

    /**
     * Get a list of all of the failed jobs.
     *
     * @return array
     */
    public function all()
    {
        return [];
    }

    /**
     * Get a single failed job.
     *
     * @param  mixed  $id
     * @return object|null
     */
    public function find($id)
    {
        //
    }

    /**
     * Delete a single failed job from storage.
     *
     * @param  mixed  $id
     * @return bool
     */
    public function forget($id)
    {
        return true;
    }

    /**
     * Flush all of the failed jobs from storage.
     *
     * @param  int|null  $hours
     * @return void
     */
    public function flush($hours = null)
    {
        //
    }

    /**
     * Count the failed jobs.
     *
     * @param  string|null  $connection
     * @param  string|null  $queue
     * @return int
     */
    public function count($connection = null, $queue = null)
    {
        return 0;
    }
}