public function serialize($jobId, $class, $args = [], $retry = true, $queue = null)
    {
        $class = is_object($class) ? get_class($class) : $class;

        $data = [
            'class' => $class,
            'jid' => $jobId,
            'created_at' => microtime(true),
            'enqueued_at' => microtime(true),
            'args' => $args,
            'retry' => $retry,
        ];

        if ($queue !== null) {
            $data['queue'] = $queue;
        }

        $jsonEncodedData = json_encode($data);

        if ($jsonEncodedData === false) {
            throw new JsonEncodeException($data, json_last_error(), json_last_error_msg());
        }

        return $jsonEncodedData;
    }
public function serialize($jobId, $class, $args = [], $retry = true, $queue = null)
    {
        $class = is_object($class) ? get_class($class) : $class;

        $data = [
            'class' => $class,
            'jid' => $jobId,
            'created_at' => microtime(true),
            'enqueued_at' => microtime(true),
            'args' => $args,
            'retry' => $retry,
        ];

        if ($queue !== null) {
            $data['queue'] = $queue;
        }

        $jsonEncodedData = json_encode($data);

        if ($jsonEncodedData === false) {
            throw new JsonEncodeException($data, json_last_error(), json_last_error_msg());
        }

        return $jsonEncodedData;
    }
public function serialize ( $ jobId , $ class , $ args = [ ] , $ retry = true , $ queue = null ) { $ class = is_object ( $ class ) ? get_class ( $ class ) : $ class ; $ data = [ 'class' => $ class , 'jid' => $ jobId , 'created_at' => microtime ( true ) , 'enqueued_at' => microtime ( true ) , 'args' => $ args , 'retry' => $ retry , ] ; if ( $ queue !== null ) { $ data [ 'queue' ] = $ queue ; } $ jsonEncodedData = json_encode ( $ data ) ; if ( $ jsonEncodedData === false ) { throw new JsonEncodeException ( $ data , json_last_error ( ) , json_last_error_msg ( ) ) ; } return $ jsonEncodedData ; }
Serialize and normalize job data

@param string        $jobId
@param object|string $class
@param array         $args
@param bool          $retry
@param string|null   $queue

@return string
@throws JsonEncodeException
Serialize and normalize job data