Stream
extends AbstractTemplate
in package
View stream template class
Tags
Table of Contents
Properties
- $blocks : array<string|int, mixed>
- Block templates
- $cacheDir : string|null
- Cache directory for compiled templates
- $contributingFiles : array<string|int, mixed>
- Files that contributed to the resolved template (path => mtime), across the full @extends/@include chain
- $data : array<string|int, mixed>
- View data
- $file : string|null
- View template file
- $master : string|null
- Master template
- $masterBlocks : array<string|int, mixed>
- Master block templates
- $output : string|null
- View output string
- $parent : Stream|null
- View parent template
- $template : string|null
- View template
Methods
- __construct() : mixed
- Constructor
- getBlock() : string|null
- Get block by name
- getBlocks() : array<string|int, mixed>
- Get blocks
- getCacheDir() : string|null
- Get cache directory
- getContributingFiles() : array<string|int, mixed>
- Get files (path => mtime) that contributed to the resolved template
- getMaster() : string
- Get master
- getMasterBlock() : string|null
- Get master block by name
- getMasterBlocks() : array<string|int, mixed>
- Get master blocks
- getParent() : self|null
- Get parent
- getTemplate() : string
- Get view template
- hasCacheDir() : bool
- Has a cache directory been configured
- isFile() : bool
- Determine if the template stream is from a file
- isString() : bool
- Determine if the template stream is from a string
- render() : string
- Render the view and return the output
- setBlock() : static
- Set block
- setBlocks() : static
- Set blocks
- setCacheDir() : static
- Set cache directory for compiled templates
- setMaster() : static
- Set master
- setMasterBlock() : static
- Set master block
- setMasterBlocks() : static
- Set master blocks
- setTemplate() : static
- Set view template with auto-detect
- assertSafeTemplatePath() : void
- Guard against path traversal / absolute-path escapes in @extends/@include targets
- parseBlocks() : void
- Parse template parent/child blocks
- parseIncludes() : void
- Parse template includes
- parseParent() : void
- Parse template parent/child blocks
- renderCompiled() : void
- Render the view template string via the compiled/cached path
- renderTemplate() : void
- Render view template string
Properties
$blocks
Block templates
protected
array<string|int, mixed>
$blocks
= []
$cacheDir
Cache directory for compiled templates
protected
string|null
$cacheDir
= null
$contributingFiles
Files that contributed to the resolved template (path => mtime), across the full @extends/@include chain
protected
array<string|int, mixed>
$contributingFiles
= []
$data
View data
protected
array<string|int, mixed>
$data
= []
$file
View template file
protected
string|null
$file
= null
$master
Master template
protected
string|null
$master
= null
$masterBlocks
Master block templates
protected
array<string|int, mixed>
$masterBlocks
= []
$output
View output string
protected
string|null
$output
= null
$parent
View parent template
protected
Stream|null
$parent
= null
$template
View template
protected
string|null
$template
= null
Methods
__construct()
Constructor
public
__construct(string $template[, string|null $cacheDir = null ]) : mixed
Instantiate the view stream template object
Parameters
- $template : string
- $cacheDir : string|null = null
getBlock()
Get block by name
public
getBlock(string $name) : string|null
Parameters
- $name : string
Return values
string|nullgetBlocks()
Get blocks
public
getBlocks() : array<string|int, mixed>
Return values
array<string|int, mixed>getCacheDir()
Get cache directory
public
getCacheDir() : string|null
Return values
string|nullgetContributingFiles()
Get files (path => mtime) that contributed to the resolved template
public
getContributingFiles() : array<string|int, mixed>
Return values
array<string|int, mixed>getMaster()
Get master
public
getMaster() : string
Return values
stringgetMasterBlock()
Get master block by name
public
getMasterBlock(string $name) : string|null
Parameters
- $name : string
Return values
string|nullgetMasterBlocks()
Get master blocks
public
getMasterBlocks() : array<string|int, mixed>
Return values
array<string|int, mixed>getParent()
Get parent
public
getParent() : self|null
Return values
self|nullgetTemplate()
Get view template
public
getTemplate() : string
Return values
stringhasCacheDir()
Has a cache directory been configured
public
hasCacheDir() : bool
Return values
boolisFile()
Determine if the template stream is from a file
public
isFile() : bool
Return values
boolisString()
Determine if the template stream is from a string
public
isString() : bool
Return values
boolrender()
Render the view and return the output
public
render([array<string|int, mixed>|null $data = null ]) : string
Parameters
- $data : array<string|int, mixed>|null = null
Return values
stringsetBlock()
Set block
public
setBlock(string $name, string $value) : static
Parameters
- $name : string
- $value : string
Return values
staticsetBlocks()
Set blocks
public
setBlocks(array<string|int, mixed> $blocks) : static
Parameters
- $blocks : array<string|int, mixed>
Return values
staticsetCacheDir()
Set cache directory for compiled templates
public
setCacheDir(string $dir) : static
Parameters
- $dir : string
Return values
staticsetMaster()
Set master
public
setMaster(string $master) : static
Parameters
- $master : string
Return values
staticsetMasterBlock()
Set master block
public
setMasterBlock(string $name, string $value) : static
Parameters
- $name : string
- $value : string
Return values
staticsetMasterBlocks()
Set master blocks
public
setMasterBlocks(array<string|int, mixed> $blocks) : static
Parameters
- $blocks : array<string|int, mixed>
Return values
staticsetTemplate()
Set view template with auto-detect
public
setTemplate(string $template) : static
Parameters
- $template : string
Return values
staticassertSafeTemplatePath()
Guard against path traversal / absolute-path escapes in @extends/@include targets
protected
static assertSafeTemplatePath(string $tmpl) : void
Parameters
- $tmpl : string
Tags
parseBlocks()
Parse template parent/child blocks
protected
parseBlocks() : void
parseIncludes()
Parse template includes
protected
parseIncludes() : void
parseParent()
Parse template parent/child blocks
protected
parseParent() : void
renderCompiled()
Render the view template string via the compiled/cached path
protected
renderCompiled() : void
renderTemplate()
Render view template string
protected
renderTemplate() : void