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
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
$channel
public
string
$channel
= 'none'
$code
public
string|null
$code
= null
$id
public
string|null
$id
= null
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
Return values
staticgetId()
A unique identifier.
public
getId() : string
Tags
Return values
stringgetMetricNames()
Gets the metric names.
public
getMetricNames() : array<int, string>
Tags
Return values
array<int, string>getName()
Gets the job name
public
getName() : string
Tags
Return values
stringjsonSerialize()
public
jsonSerialize() : mixed
Tags
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
metric()
Set a metric
public
metric(int $num, int $value) : void
Parameters
- $num : int
-
The metric index; 1, 2, or 3
- $value : int