NaifyView\Executor\TemplateLoader クラス
TemplateLoader — AST実行用のテンプレートを解決し、読み込んで解析する
探索ルートと現在のテンプレートを基準にファイルを探し、解析結果と観測情報を保持する。
ASTを直接実行する経路の内部部品。通常の描画にはView::render()を使う。
プロパティ
| 名前 | 型 | 説明 |
|---|---|---|
private
$parser
|
NaifyParser |
parse owner |
private
$templateRoots
|
array |
engine から渡された template roots |
private
$templateCache
|
array |
parsed template cache |
private
$resolveCalls
|
int |
resolveTemplatePath() 呼び出し回数 |
private
$loadCalls
|
int |
loadTemplate() 呼び出し回数 |
private
$templateCacheHits
|
int |
parsed template cache hit 件数 |
private
$templateCacheMisses
|
int |
parsed template cache miss 件数 |
private
$parseCalls
|
int |
parse 実行件数 |
メソッド
| メソッド | 説明 |
|---|---|
public
__construct(NaifyParser $parser, array $templateRoots = '...'): void
|
インスタンスを初期化する |
public
resolveTemplatePath(string $source, string $currentTemplatePath): string
|
`resolveTemplatePath()` を実行する |
private
buildPathNotFoundException(string $source, string $currentTemplatePath): NaifyViewException
|
|
private
isWithinTemplateRoots(string $resolvedPath): bool
|
解決済みパスが設定済み template root の内側にあるかを返す
template root を指定しない低レベル利用では、従来どおり current template からの相対解決を許可する。Engine 経由では必ず root が渡される。 |
public
loadTemplate(string $templatePath): array
|
`loadTemplate()` を実行する |
public
getStats(): array
|
`getStats()` の値を返す |