BlockRegistry
in package
FinalYes
Immutable registry of named content blocks for layout composition.
Used to implement layout inheritance: a parent template defines block slots, and child templates override them by setting blocks in the registry. Each set() call returns a new instance (immutable).
Table of Contents
Properties
- $blocks : array<string|int, mixed>
Methods
- create() : self
- get() : Node
- getOrDefault() : Node
- has() : bool
- set() : self
- __construct() : mixed
Properties
$blocks read-only
private
array<string|int, mixed>
$blocks
= []
Methods
create()
public
static create() : self
Return values
selfget()
public
get(string $name) : Node
Parameters
- $name : string
Return values
NodegetOrDefault()
public
getOrDefault(string $name, Node $default) : Node
Parameters
- $name : string
- $default : Node
Return values
Nodehas()
public
has(string $name) : bool
Parameters
- $name : string
Return values
boolset()
public
set(string $name, Node $content) : self
Parameters
- $name : string
- $content : Node
Return values
self__construct()
private
__construct([array<string, Node> $blocks = [] ]) : mixed
Parameters
- $blocks : array<string, Node> = []