class UsedTranslationTranslatorCollector implements Collector

Traits

Upstream collects only the key. The missing-translation rule resolves each lookup through the booted translator, so the call's locale, fallback and operation are collected with it.

Methods

array|null
translationLookup(CallLike $call, bool $choice, bool $acceptsFallback, Scope|null $scope)

Get the lookup made by a call with a literal translation key.

array|null
translationLocales(Expr|null $locale, Scope|null $scope)

Get the locales a lookup can use, where null is the translator's current locale.

bool
translationFallback(Expr|null $fallback, Scope|null $scope)

Determine whether a lookup can use the fallback locale.

string
getNodeType()

Get the node type the collector inspects.

array|null
processNode(Node $node, Scope $scope)

Collect the translation looked up through a translator.

Details

protected array|null translationLookup(CallLike $call, bool $choice, bool $acceptsFallback, Scope|null $scope)

Get the lookup made by a call with a literal translation key.

Parameters

CallLike $call
bool $choice

whether the call is a choice() lookup, whose locale follows the count

bool $acceptsFallback

whether the call has get()'s fallback parameter

Scope|null $scope

Return Value

array|null

protected array|null translationLocales(Expr|null $locale, Scope|null $scope)

Get the locales a lookup can use, where null is the translator's current locale.

Parameters

Expr|null $locale
Scope|null $scope

Return Value

array|null

protected bool translationFallback(Expr|null $fallback, Scope|null $scope)

Determine whether a lookup can use the fallback locale.

An unknown value counts as true: a translation missing with the fallback locale is also missing without it.

Parameters

Expr|null $fallback
Scope|null $scope

Return Value

bool

at line 32
string getNodeType()

Get the node type the collector inspects.

Return Value

string

at line 44
array|null processNode(Node $node, Scope $scope)

Collect the translation looked up through a translator.

Parameters

Node $node
Scope $scope

Return Value

array|null