NaifyView\Runtime\CompiledTemplateRuntime クラス

CompiledTemplateRuntime — generated runtime ABI の Compiled Template Runtime

compiled template class から呼ばれる runtime surface。 compiler が生成する PHP と対になるため、変更時は generated code との互換を意識する。

使用例

// generated PHP class から呼ばれる runtime ABI。
// compiler が吐いたコードと対になるため、公開 API として直接使わない。

プロパティ

名前型説明
private $evaluator NaifyExpressionEvaluator expression evaluator
private $callableRuntime NaifyCallableRuntime
private $valueTransformRuntime NaifyValueTransformRuntime
private $pathRuntime CompiledPathRuntime
private $valueRuntime CompiledValueRuntime
private $templateStateRuntime CompiledTemplateStateRuntime
private static $fallbackSession ?RuntimeSession session が無い呼び出しで使う read-only fallback
private $currentSession ?RuntimeSession
private $sessionStack array nested render session stack
private $dynamicIncludeRenderer mixed runtime include renderer callback

メソッド

メソッド説明
public static clearProcessCaches(): void process 単位で持っている compiled runtime fallback state をクリアする
public __construct(?NaifyExpressionEvaluator $evaluator, ?NaifyValueTransformRuntime $valueTransformRuntime, array $filterHandlers = '...', array $callableProviders = '...', ?CompiledPathRuntime $pathRuntime, ?CompiledValueRuntime $valueRuntime, ?CompiledTemplateStateRuntime $templateStateRuntime, bool $autoEscape = false, ?callable $dynamicIncludeRenderer): void インスタンスを初期化する
public setDynamicIncludeRenderer(?callable $dynamicIncludeRenderer): void `setDynamicIncludeRenderer()` の値を設定する
public evaluate(string $expression, array $scope): mixed `evaluate()` を実行する
public evaluateFallback(string $expression, array $scope, bool $normalized = false): mixed compiled fast path で直生成できず runtime evaluator に逃がした式を評価する
public applyDotFilter(string $filterName, mixed $value, array $arguments = '...'): mixed `applyDotFilter()` を実行する
public invokeCallableValue(string $callableName, array $arguments, array $scope): mixed `invokeCallableValue()` を実行する
public invokeTrustedMethodValue(mixed $target, string $rootToken, string $methodName, array $arguments, string $expression, array $scope = '...'): mixed `invokeTrustedMethodValue()` を実行する
public assertTrustedRootAvailable(string $rootToken, string $expression, array $scope = '...'): bool trusted root が現在の scope でも元の binding を指していることを検証する
generated PHP は target や引数を評価する前にこの guard を呼ぶ。
成功時に true を返すため、短絡する条件式の先頭へ安全に埋め込める。
public filterEscape(mixed $value, mixed $strategy = html): mixed `filterEscape()` を実行する
public filterLower(mixed $value): string `filterLower()` を実行する
public filterUpper(mixed $value): string `filterUpper()` を実行する
public filterTrim(mixed $value, mixed $mask): string `filterTrim()` を実行する
public filterNl2br(mixed $value): mixed `filterNl2br()` を実行する
public filterReplace(mixed $value, array $arguments = '...'): string `filterReplace()` を実行する
public filterContains(mixed $value, mixed $needle = ): bool `filterContains()` を実行する
public filterStartsWith(mixed $value, mixed $prefix = ): bool `filterStartsWith()` を実行する
public filterEndsWith(mixed $value, mixed $suffix = ): bool `filterEndsWith()` を実行する
public filterTruncate(mixed $value, array $arguments = '...'): string `filterTruncate()` を実行する
public filterKeys(mixed $value): array `filterKeys()` を実行する
public filterSort(mixed $value): array `filterSort()` を実行する
public filterJoin(mixed $value, mixed $separator = ): string `filterJoin()` を実行する
public filterFirst(mixed $value): mixed `filterFirst()` を実行する
public filterLast(mixed $value): mixed `filterLast()` を実行する
public filterSlice(mixed $value, array $arguments = '...'): mixed `filterSlice()` を実行する
public filterDefault(mixed $value, mixed $fallback): mixed `filterDefault()` を実行する
public filterJsonDecode(mixed $value): mixed `filterJsonDecode()` を実行する
public filterSplit(mixed $value, array $arguments = '...'): array `filterSplit()` を実行する
public filterMerge(mixed $value, mixed $other = '...'): array `filterMerge()` を実行する
public filterUrlEncode(mixed $value): string `filterUrlEncode()` を実行する
public filterJsonEncode(mixed $value): string `filterJsonEncode()` を実行する
public filterToString(mixed $value): string `filterToString()` を実行する
public filterToStringWithExistence(mixed $value, bool $exists): string `filterToStringWithExistence()` を実行する
public filterToDate(mixed $value, mixed $format = Y-m-d H:i:s): string `filterToDate()` を実行する
public filterRound(mixed $value, mixed $precision = 0): int|float `filterRound()` を実行する
public filterRaw(mixed $value): mixed `filterRaw()` を実行する
public filterLength(mixed $value): int `filterLength()` を実行する
public filterIsEmpty(mixed $value): bool `filterIsEmpty()` を実行する
public filterIsEmptyWithExistence(mixed $value, bool $exists): bool `filterIsEmptyWithExistence()` を実行する
public filterIsDefined(mixed $value): bool `filterIsDefined()` を実行する
public filterIsDefinedWithExistence(mixed $value, bool $exists): bool `filterIsDefinedWithExistence()` を実行する
public beginSession(RuntimeSession $session): void `beginSession()` を実行する
public clearSession(): void `clearSession()` をクリアする
public getCurrentSession(): ?RuntimeSession `getCurrentSession()` の値を返す
public pushParentScope(array $parent, bool $allowWrite): int Generated scope boundaries always pair entry with a finally cleanup.
public popParentScope(int $token): void
public writeParentBinding(int $depth, string $name, mixed $value, bool $append = false): void
private requireCurrentSession(): RuntimeSession
public readParentPathValue(int $depth, array $segments): mixed
public isParentPathDefined(int $depth, array $segments): bool
public getCurrentTrustedRoots(): array `getCurrentTrustedRoots()` の値を返す
public getCurrentRenderStartedAt(): int `getCurrentRenderStartedAt()` の値を返す
public buildCurrentNaifyPayload(string $fallbackTemplatePath, string $fallbackMode): array `buildCurrentNaifyPayload()` を実行する
public createRootScope(array $context): array `createRootScope()` を実行する
public createRootContext(array $context, string $templatePath, int $recursionLimit): RuntimeContext `createRootContext()` を実行する
public renderDynamicInclude(RuntimeContext $context, array $scope, array $state, mixed $template, string $currentTemplatePath, int $recursionLimit): string `renderDynamicInclude()` を実行する
public renderMacroCall(string $name, RuntimeContext $context, array $arguments): string Invoke a macro retained in render-local state, including across compiled include artifacts.
public readRootPathValue(array $scope, string $rootKey, array $segments): mixed
public readPathValueWithExistence(array $scope, string $rootToken, array $segments, string $templatePath, string $entryMode): mixed Resolve a filter operand without repeating getters or dynamic array access.
public readRootSegmentValue(array $scope, string $rootKey, mixed $segment): mixed `readRootSegmentValue()` を実行する
public readRootPairValue(array $scope, string $rootKey, mixed $firstSegment, mixed $secondSegment): mixed `readRootPairValue()` を実行する
public readRootTripleValue(array $scope, string $rootKey, mixed $firstSegment, mixed $secondSegment, mixed $thirdSegment): mixed `readRootTripleValue()` を実行する
public isRootPathDefined(array $scope, string $rootKey, array $segments): bool `isRootPathDefined()` かを返す
public readPublicPathValue(array $scope, array $segments): mixed `readPublicPathValue()` を実行する
public isPublicPathDefined(array $scope, array $segments): bool `isPublicPathDefined()` かを返す
public readSpecialPathValue(array $scope, array $segments, string $fallbackTemplatePath, string $fallbackMode): mixed `readSpecialPathValue()` を実行する
public readPathSegments(mixed $value, array $segments): mixed `readPathSegments()` を実行する
public isSpecialPathDefined(array $scope, array $segments, string $fallbackTemplatePath, string $fallbackMode): bool `isSpecialPathDefined()` かを返す
public stringifyValue(mixed $value): string `stringifyValue()` を実行する
public outputValue(mixed $value): string `outputValue()` を実行する
public expressionValue(mixed $value): string `expressionValue()` を実行する
public normalizeNumericValue(mixed $value, string $expression): int|float `normalizeNumericValue()` を実行する
public calculateArithmeticValue(mixed $left, mixed $right, string $operator, string $leftExpression, string $rightExpression): int|float compiled arithmetic の除算・剰余を evaluator と同じ契約で計算する
public normalizeRangeValue(mixed $value, string $expression): int `normalizeRangeValue()` を実行する
public buildRangeValueList(mixed $startValue, mixed $endValue, string $expression): array `buildRangeValueList()` を実行する
public createTemplateState(string $templatePath, int $recursionLimit): array `createTemplateState()` を実行する
public enterTemplateState(array $state, string $templatePath, string $relation, int $defaultRecursionLimit): array `enterTemplateState()` を実行する
public resolveBlockOverride(array $state, string $blockName): ?array `resolveBlockOverride()` を実行する
public debugCheckpoint(string $label): void `debugCheckpoint()` を実行する
private assertRootContextIsSafe(array $context): void `assertRootContextIsSafe()` を実行する
private isProtectedInputKey(mixed $key): bool `isProtectedInputKey()` かを返す
private extractPublicScope(array $context): array `extractPublicScope()` を実行する