FileTemplateEngine
in package
implements
ITemplateEngine
File-based template engine for loading stub files
Table of Contents
Interfaces
- ITemplateEngine
- Template engine for loading and rendering stub files
Properties
- $fs : IFileSystem
- $stubPath : string
Methods
- __construct() : mixed
- exists() : bool
- Check if a template exists
- load() : string|null
- Load raw template content
- render() : string
- Render template with data replacements
Properties
$fs
private
IFileSystem
$fs
$stubPath
private
string
$stubPath
Methods
__construct()
public
__construct(IFileSystem $fs, string $stubPath) : mixed
Parameters
- $fs : IFileSystem
-
Filesystem implementation
- $stubPath : string
-
Base path to stub files
exists()
Check if a template exists
public
exists(string $template) : bool
Parameters
- $template : string
-
Template name (e.g., 'controller.resource.stub')
Tags
Return values
boolload()
Load raw template content
public
load(string $template) : string|null
Parameters
- $template : string
-
Template name
Tags
Return values
string|null —Template content or null if not found
render()
Render template with data replacements
public
render(string $template, array<string|int, mixed> $data) : string
Parameters
- $template : string
-
Template name
- $data : array<string|int, mixed>
-
Key-value pairs for {{placeholder}} replacement
Tags
Return values
string —Rendered content