KMP PHP API Reference

Processor
in package
uses LocatorAwareTrait

Main shell to init and run queue workers.

Table of Contents

Properties

$container  : ContainerInterface|null
$exit  : bool
$io  : Io
$logger  : LoggerInterface
$pid  : string|null
$QueuedJobs  : QueuedJobsTable
$QueueProcesses  : QueueProcessesTable
$taskConf  : array<string, array<string, mixed>>|null
$time  : int

Methods

__construct()  : mixed
run()  : int
abort()  : void
Signal handling for Ctrl+C
deletePid()  : void
exit()  : void
Signal handling to queue worker for clean shutdown
getConfig()  : array<string, mixed>
getTaskClass()  : string
getTaskConf()  : array<string, array<string, mixed>>
Returns a List of available QueueTasks and their individual configuration.
initPid()  : string
loadTask()  : TaskInterface
log()  : void
Timestamped log.
logError()  : void
memoryUsage()  : string
retrievePid()  : string
runJob()  : void
setPhpTimeout()  : void
Makes sure accidental overriding isn't possible, uses workermaxruntime times 100 by default.
stringToArray()  : array<string|int, string>
time()  : int
timeNeeded()  : string
updatePid()  : void

Properties

$container

protected ContainerInterface|null $container = null

$taskConf

protected array<string, array<string, mixed>>|null $taskConf = null

Methods

__construct()

public __construct(Io $io, LoggerInterface $logger[, ContainerInterface|null $container = null ]) : mixed
Parameters
$io : Io
$logger : LoggerInterface
$container : ContainerInterface|null = null

run()

public run(array<string, mixed> $args) : int
Parameters
$args : array<string, mixed>
Return values
int

abort()

Signal handling for Ctrl+C

protected abort([int $signal = 1 ]) : void
Parameters
$signal : int = 1

deletePid()

protected deletePid(string|null $pid) : void
Parameters
$pid : string|null

exit()

Signal handling to queue worker for clean shutdown

protected exit(int $signal) : void
Parameters
$signal : int

getConfig()

protected getConfig(array<string, mixed> $args) : array<string, mixed>
Parameters
$args : array<string, mixed>
Return values
array<string, mixed>

getTaskClass()

protected getTaskClass(string $taskName) : string
Parameters
$taskName : string
Tags
psalm-return

class-string<\Queue\Queue\Task>

Return values
string

getTaskConf()

Returns a List of available QueueTasks and their individual configuration.

protected getTaskConf() : array<string, array<string, mixed>>
Return values
array<string, array<string, mixed>>

initPid()

protected initPid() : string
Return values
string

log()

Timestamped log.

protected log(string $message[, string|null $pid = null ][, bool $addDetails = true ]) : void
Parameters
$message : string

Log type

$pid : string|null = null

PID of the process

$addDetails : bool = true

logError()

protected logError(string $message[, string|null $pid = null ]) : void
Parameters
$message : string
$pid : string|null = null

PID of the process

memoryUsage()

protected memoryUsage() : string
Return values
string

Memory usage in MB.

retrievePid()

protected retrievePid() : string
Return values
string

setPhpTimeout()

Makes sure accidental overriding isn't possible, uses workermaxruntime times 100 by default.

protected setPhpTimeout() : void

If available, uses workertimeout config directly.

stringToArray()

protected stringToArray(string $param) : array<string|int, string>
Parameters
$param : string
Return values
array<string|int, string>

time()

protected time([int|null $providedTime = null ]) : int
Parameters
$providedTime : int|null = null
Return values
int

timeNeeded()

protected timeNeeded() : string
Return values
string

updatePid()

protected updatePid(string $pid) : void
Parameters
$pid : string

        
On this page

Search results