trait ResolvesOnce

Traits

Properties

protected bool $once

Indicates if the prop should be resolved only once.

protected bool $refresh

Indicates if the prop should be forcefully refreshed.

protected int|null $ttl

The expiration time in seconds.

protected string|null $key

The custom key for resolving the once prop.

Methods

int
secondsUntil(DateInterval|DateTimeInterface|int $delay)

Get the number of seconds until the given DateTime.

int
availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)

If the given value is an interval, convert it to a DateTime instance.

int
currentTime()

Get the current system time as a UNIX timestamp.

string
runTimeForHumans(float $startTime, float|null $endTime = null)

Given a start time, format the total run time for human readability.

once(bool $value = true, string|null $as = null, DateTimeInterface|DateInterval|int|null $until = null)

Mark the prop to be resolved only once.

bool
shouldResolveOnce()

Determine if the prop should be resolved only once.

bool
shouldBeRefreshed()

Determine if the prop should be forcefully refreshed.

string|null
getKey()

Get the custom key for resolving the once prop.

as(BackedEnum|UnitEnum|string $key)

Set a custom key for resolving the once prop.

fresh(bool $value = true)

Mark the property to be forcefully sent to the client.

until(DateTimeInterface|DateInterval|int $delay)

Set the expiration for the once prop.

int|null
expiresAt()

Get the expiration timestamp in milliseconds for the once prop.

Details

in InteractsWithTime at line 17
protected int secondsUntil(DateInterval|DateTimeInterface|int $delay)

Get the number of seconds until the given DateTime.

Parameters

DateInterval|DateTimeInterface|int $delay

Return Value

int

in InteractsWithTime at line 29
protected int availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

int

in InteractsWithTime at line 41
protected DateTimeInterface|int parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)

If the given value is an interval, convert it to a DateTime instance.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

DateTimeInterface|int

in InteractsWithTime at line 57
protected int currentTime()

Get the current system time as a UNIX timestamp.

Return Value

int

in InteractsWithTime at line 65
protected string runTimeForHumans(float $startTime, float|null $endTime = null)

Given a start time, format the total run time for human readability.

Parameters

float $startTime
float|null $endTime

Return Value

string

at line 40
ResolvesOnce once(bool $value = true, string|null $as = null, DateTimeInterface|DateInterval|int|null $until = null)

Mark the prop to be resolved only once.

Parameters

bool $value
string|null $as
DateTimeInterface|DateInterval|int|null $until

Return Value

ResolvesOnce

at line 58
bool shouldResolveOnce()

Determine if the prop should be resolved only once.

Return Value

bool

at line 66
bool shouldBeRefreshed()

Determine if the prop should be forcefully refreshed.

Return Value

bool

at line 74
string|null getKey()

Get the custom key for resolving the once prop.

Return Value

string|null

at line 82
ResolvesOnce as(BackedEnum|UnitEnum|string $key)

Set a custom key for resolving the once prop.

Parameters

BackedEnum|UnitEnum|string $key

Return Value

ResolvesOnce

at line 96
ResolvesOnce fresh(bool $value = true)

Mark the property to be forcefully sent to the client.

Parameters

bool $value

Return Value

ResolvesOnce

at line 106
ResolvesOnce until(DateTimeInterface|DateInterval|int $delay)

Set the expiration for the once prop.

Parameters

DateTimeInterface|DateInterval|int $delay

Return Value

ResolvesOnce

at line 116
int|null expiresAt()

Get the expiration timestamp in milliseconds for the once prop.

Return Value

int|null