master

laravel/framework

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

JobRetryRequested.php

TLDR

This file contains a class called JobRetryRequested which represents an event that is fired when a job is requested to be retried.

Classes

JobRetryRequested

The JobRetryRequested class represents an event that is fired when a job is requested to be retried. It has the following properties and methods:

  • $job: A public property that holds the job instance.
  • $payload: A protected property that holds the decoded job payload.
  • __construct($job): A constructor method that initializes the JobRetryRequested instance with the given job.
  • payload(): A method that returns the job payload, decoding it if necessary.
<?php

namespace Illuminate\Queue\Events;

class JobRetryRequested
{
    /**
     * The job instance.
     *
     * @var \stdClass
     */
    public $job;

    /**
     * The decoded job payload.
     *
     * @var array|null
     */
    protected $payload = null;

    /**
     * Create a new event instance.
     *
     * @param  \stdClass  $job
     * @return void
     */
    public function __construct($job)
    {
        $this->job = $job;
    }

    /**
     * The job payload.
     *
     * @return array
     */
    public function payload()
    {
        if (is_null($this->payload)) {
            $this->payload = json_decode($this->job->payload, true);
        }

        return $this->payload;
    }
}