class FormattedDateDiff implements RenderableInterface, CacheableDependencyInterface (View source)

Contains a formatted time difference.

Traits

Trait to implement CacheableDependencyInterface for unchanging objects.

Properties

protected string $string

The actual formatted time difference.

protected int $maxAge

The maximum time in seconds that this string may be cached.

Methods

int
getCacheMaxAge()

The maximum age for which this object may be cached.

__construct(string $string, int $max_age)

Creates a new FormattedDateDiff instance.

string
getString()

No description

array
toRenderable()

Returns a render array representation of the object.

Details

getCacheContexts()

{@inheritdoc}

getCacheTags()

{@inheritdoc}

int getCacheMaxAge()

The maximum age for which this object may be cached.

Return Value

int

The maximum time in seconds that this object may be cached.

__construct(string $string, int $max_age)

Creates a new FormattedDateDiff instance.

Parameters

string $string

The formatted time difference.

int $max_age

The maximum time in seconds that this string may be cached.

string getString()

No description

Return Value

string

array toRenderable()

Returns a render array representation of the object.

Return Value

array

A render array.