NaifyView\Compiler\CompiledTemplateMethodRegistry クラス

CompiledTemplateMethodRegistry — compiled mainline の Compiled Template Method Registry

template を generated PHP class へ落とす compile pipeline の一部。 大きな compiler へ責務を押し込まず、source 生成・依存計画・fast path などを小さく分ける。

使用例

// Engine が warm-hit できない template を compiled artifact へ変換する時に使う。
// 通常は View / Engine 経由で呼ばれ、アプリ側から直接操作しない。

プロパティ

名前型説明
private $compileSession CompiledClassCompileSession
private $dependencyPlanner CompiledArtifactDependencyPlanner
private $sourceMetadataBuilder CompiledGeneratedSourceMetadataBuilder
private $templatePathResolver CompiledTemplatePathResolver
private $parser NaifyParser
private $compileNodeList Closure

メソッド

メソッド説明
public __construct(CompiledClassCompileSession $compileSession, CompiledArtifactDependencyPlanner $dependencyPlanner, CompiledGeneratedSourceMetadataBuilder $sourceMetadataBuilder, CompiledTemplatePathResolver $templatePathResolver, NaifyParser $parser, Closure $compileNodeList): void インスタンスを初期化する
public registerTemplateMethod(string $templatePath, string $templateSource, DocumentNode $document, array $compiledTemplates, int $counter): string `registerTemplateMethod()` を実行する
public registerSlotOverrideMethod(SlotNode $node, string $templatePath, string $templateSource, array $compiledTemplates, int $counter, int $loopDepth = 0): string `registerSlotOverrideMethod()` を実行する
public readTemplateSource(string $templatePath, array $compiledTemplates): string `readTemplateSource()` を実行する
public recordTemplateDependency(string $templatePath, DocumentNode $document): void `recordTemplateDependency()` を実行する
public requireLayoutDefinitionMethod(string $templatePath, string $layoutName): string `requireLayoutDefinitionMethod()` を実行する
public loadTemplateDocument(string $resolvedPath): array `loadTemplateDocument()` を実行する
public macroMethodEntries(): array `macroMethodEntries()` を実行する
private buildExtendsBodyLines(ExtendsNode $extendsNode, array $preludeNodes, array $blockMethodNames, string $currentTemplatePath, array $compiledTemplates, int $counter): array `buildExtendsBodyLines()` を実行する
private declareMacroMethod(MacroNode $node, string $templatePath, string $templateSource): void Reserve a root macro before compiling bodies, so definition order is irrelevant.
private registerMacroMethod(MacroNode $node, string $templatePath, string $templateSource, array $compiledTemplates, int $counter): void Compile the body of a previously declared macro.
private registerLayoutDefinitionMethod(LayoutNode $node, string $templatePath, string $templateSource, array $compiledTemplates, int $counter): void `registerLayoutDefinitionMethod()` を実行する
private registerBlockMethod(BlockNode $node, string $templatePath, string $templateSource, array $compiledTemplates, int $counter): string `registerBlockMethod()` を実行する
private registerBodyMethod(string $methodKey, string $methodName, string $templatePath, string $templateSource, array $nodes, array $compiledTemplates, int $counter, int $loopDepth = 0): void `registerBodyMethod()` を実行する
private buildBlockOverrideEntries(array $blockMethodNames, string $templatePath): array `buildBlockOverrideEntries()` を実行する
private buildTemplateMethodName(string $templatePath, bool $isRoot): string `buildTemplateMethodName()` を実行する
private buildMacroMethodName(string $templatePath, string $macroName): string `buildMacroMethodName()` を実行する
private buildLayoutDefinitionMethodName(string $templatePath, string $layoutName): string `buildLayoutDefinitionMethodName()` を実行する
private buildBlockMethodName(string $templatePath, string $blockName): string `buildBlockMethodName()` を実行する
private buildSlotOverrideMethodName(string $templatePath, string $slotName, int $seed): string `buildSlotOverrideMethodName()` を実行する
private safeMethodSuffix(string $name, string $fallback): string `safeMethodSuffix()` を実行する
private compileNodes(array $nodes, string $scopeVar, string $outputVar, int $indentLevel, int $counter, int $loopDepth, string $stateVar, string $slotOverridesVar, string $currentTemplatePath, array $compiledTemplates): array `compileNodes()` を実行する