Meilisearch PHP | Documentation

Task
in package
implements ArrayAccess

FinalYes
Tags
phpstan-type

RawTaskError array{ message: non-empty-string, code: non-empty-string, type: non-empty-string, link: non-empty-string }

RawTask array{ taskUid?: non-negative-int, uid?: non-negative-int, indexUid?: non-empty-string, status: non-empty-string, type: non-empty-string, enqueuedAt: non-empty-string, startedAt?: non-empty-string|null, finishedAt?: non-empty-string|null, duration?: non-empty-string|null, canceledBy?: non-negative-int, batchUid?: non-negative-int, details?: array|null, error?: RawTaskError|null }

Raw detail shapes are imported here so Task can choose the concrete detail class while keeping shape validation at this boundary.

phpstan-import-type

RawDocumentAdditionOrUpdateDetails from DocumentAdditionOrUpdateDetails

RawDocumentDeletionDetails from DocumentDeletionDetails

RawDocumentEditionDetails from DocumentEditionDetails

RawDumpCreationDetails from DumpCreationDetails

RawIndexCompactionDetails from IndexCompactionDetails

RawIndexCreationDetails from IndexCreationDetails

RawIndexDeletionDetails from IndexDeletionDetails

RawIndexSwapDetails from IndexSwapDetails

RawIndexUpdateDetails from IndexUpdateDetails

RawSettingsUpdateDetails from SettingsUpdateDetails

RawTaskCancelationDetails from TaskCancelationDetails

RawTaskDeletionDetails from TaskDeletionDetails

Table of Contents

Interfaces

ArrayAccess

Properties

$await  : Closure|null
$batchUid  : int|null
$canceledBy  : int|null
$details  : TaskDetails|null
$duration  : string|null
$enqueuedAt  : DateTimeImmutable
$error  : TaskError|null
$finishedAt  : DateTimeImmutable|null
$indexUid  : string|null
$raw  : array<string|int, mixed>
$startedAt  : DateTimeImmutable|null
$status  : TaskStatus
$taskUid  : int
$type  : TaskType

Methods

__construct()  : mixed
fromArray()  : Task
getBatchUid()  : int|null
getCanceledBy()  : int|null
getDetails()  : TaskDetails|null
getDuration()  : non-empty-string|null
getEnqueuedAt()  : DateTimeImmutable
getError()  : TaskError|null
getFinishedAt()  : DateTimeImmutable|null
getIndexUid()  : non-empty-string|null
getStartedAt()  : DateTimeImmutable|null
getStatus()  : TaskStatus
getTaskUid()  : int
getType()  : TaskType
isFinished()  : bool
offsetExists()  : bool
offsetGet()  : mixed
offsetSet()  : void
offsetUnset()  : void
toArray()  : array<string|int, mixed>
wait()  : Task
detailFromArray()  : TDetails
detailsFromArray()  : TaskDetails|null

Properties

$await read-only

private Closure|null $await = null

$batchUid read-only

private int|null $batchUid = null

$canceledBy read-only

private int|null $canceledBy = null

$duration read-only

private string|null $duration = null

$enqueuedAt read-only

private DateTimeImmutable $enqueuedAt

$finishedAt read-only

private DateTimeImmutable|null $finishedAt = null

$indexUid read-only

private string|null $indexUid

$raw read-only

private array<string|int, mixed> $raw = []

$startedAt read-only

private DateTimeImmutable|null $startedAt = null

$taskUid read-only

private int $taskUid

Methods

__construct()

public __construct(int $taskUid, non-empty-string|null $indexUid, TaskStatus $status, TaskType $type, DateTimeImmutable $enqueuedAt[, DateTimeImmutable|null $startedAt = null ][, DateTimeImmutable|null $finishedAt = null ][, non-empty-string|null $duration = null ][, int|null $canceledBy = null ][, int|null $batchUid = null ][, TaskDetails|null $details = null ][, TaskError|null $error = null ][, array<string|int, mixed> $raw = [] ][, callable(int, int, int): Task|null $await = null ]) : mixed
Parameters
$taskUid : int
$indexUid : non-empty-string|null
$status : TaskStatus
$type : TaskType
$enqueuedAt : DateTimeImmutable
$startedAt : DateTimeImmutable|null = null
$finishedAt : DateTimeImmutable|null = null
$duration : non-empty-string|null = null
$canceledBy : int|null = null
$batchUid : int|null = null
$details : TaskDetails|null = null
$error : TaskError|null = null
$raw : array<string|int, mixed> = []
$await : callable(int, int, int): Task|null = null

fromArray()

public static fromArray(RawTask $data[, callable(int, int, int): Task|null $await = null ]) : Task
Parameters
$data : RawTask
$await : callable(int, int, int): Task|null = null
Return values
Task

getBatchUid()

public getBatchUid() : int|null
Return values
int|null

getCanceledBy()

public getCanceledBy() : int|null
Return values
int|null

getDuration()

public getDuration() : non-empty-string|null
Return values
non-empty-string|null

getEnqueuedAt()

public getEnqueuedAt() : DateTimeImmutable
Return values
DateTimeImmutable

getFinishedAt()

public getFinishedAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|null

getIndexUid()

public getIndexUid() : non-empty-string|null
Return values
non-empty-string|null

getStartedAt()

public getStartedAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|null

getTaskUid()

public getTaskUid() : int
Return values
int

isFinished()

public isFinished() : bool
Return values
bool

offsetExists()

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Return values
bool

offsetGet()

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed

offsetSet()

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed
$value : mixed

offsetUnset()

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed

toArray()

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

wait()

public wait([int $timeoutInMs = 5000 ][, int $intervalInMs = 50 ]) : Task
Parameters
$timeoutInMs : int = 5000
$intervalInMs : int = 50
Return values
Task

detailFromArray()

private static detailFromArray(array<string|int, mixed> $details, callable(TShape): TDetails $factory) : TDetails
Parameters
$details : array<string|int, mixed>
$factory : callable(TShape): TDetails
Tags
template
Return values
TDetails

detailsFromArray()

private static detailsFromArray(TaskType $type, array<string|int, mixed>|null $details) : TaskDetails|null
Parameters
$type : TaskType
$details : array<string|int, mixed>|null
Return values
TaskDetails|null
On this page

Search results