src/Jobs/AbstractJob.php
public function setData($data): void
    {
        if (is_array($data) == false && is_string($data) == false && $data instanceof JobData == false) {
            throw new InvalidArgumentException(
                sprintf(
                    "Job's data must be either an array, or a JobData instance, or a JSON string, %s given.",
                    gettype($data)
                )
            );
        }

        if (is_array($data) == true) {
            $data =  new JobData($data);
        } elseif (is_string($data) == true) {
            // Assume this is JSON
            $data =  new JobData(json_decode($data, true));
        }

        $this->data = $data;
    }
public function setData($data): void
    {
        if (is_array($data) == false && is_string($data) == false && $data instanceof JobData == false) {
            throw new InvalidArgumentException(
                sprintf(
                    "Job's data must be either an array, or a JobData instance, or a JSON string, %s given.",
                    gettype($data)
                )
            );
        }

        if (is_array($data) == true) {
            $data =  new JobData($data);
        } elseif (is_string($data) == true) {
            // Assume this is JSON
            $data =  new JobData(json_decode($data, true));
        }

        $this->data = $data;
    }
Sets Job's data.

@param  JobData|array|string $data
@return void

@throws InvalidArgumentException