Documentation

WorkerJob
in package
implements WorkerJobInterface, LogSinkInterface

AbstractYes

Base class for worker jobs.

This class superceeds the old WorkerBase class.

Table of Contents

Interfaces

WorkerJobInterface
Interface for worker jobs.
LogSinkInterface
This class can receive logs.

Properties

$channel  : string
$code  : string|null
$id  : string|null

Methods

fromJson()  : static
Create an object from a JSON array.
getId()  : string
A unique identifier.
getMetricNames()  : array<int, string>
Gets the metric names.
getName()  : string
Gets the job name
jsonSerialize()  : mixed
log()  : void
Log something.
metric()  : void
Set a metric

Properties

Methods

fromJson()

Create an object from a JSON array.

public static fromJson(array<string|int, mixed> $json) : static
Parameters
$json : array<string|int, mixed>
Tags
inheritdoc
Return values
static

getId()

A unique identifier.

public getId() : string
Tags
inheritdoc
Return values
string

getMetricNames()

Gets the metric names.

public getMetricNames() : array<int, string>
Tags
inheritdoc
Return values
array<int, string>

getName()

Gets the job name

public getName() : string
Tags
inheritdoc
Return values
string

jsonSerialize()

public jsonSerialize() : mixed
Tags
inheritdoc

log()

Log something.

public log(mixed $message[, int|null $level = null ][, string|null $_category = null ][, mixed $_timestamp = null ]) : void
Parameters
$message : mixed

string, array, exception - whatever

$level : int|null = null
$_category : string|null = null
$_timestamp : mixed = null
Tags
inheritdoc

metric()

Set a metric

public metric(int $num, int $value) : void
Parameters
$num : int

The metric index; 1, 2, or 3

$value : int
On this page

Search results