NaifyView\Ast\ElementNode クラス
extends
NaifyView\Ast\AbstractNode
implements
NaifyView\Ast\NodeInterface
ElementNode — タグの名前・属性・子ノードを保持する
自己終了タグか、ディレクティブとして読んだかも記録する。 HTMLの出力文字列をここで作らず、構造をコンパイラーや実行側へ渡す。
プロパティ
| 名前 | 型 | 説明 |
|---|---|---|
private
$name
|
string |
タグ名 |
private
$attributes
|
array |
属性名と値 |
private
$children
|
array |
記述順の子ノード |
private
$selfClosing
|
bool |
単独で閉じるタグか |
private
$directive
|
bool |
テンプレート命令のタグか |
メソッド
| メソッド | 説明 |
|---|---|
public
override
__construct(SourceSpan $span, string $name, array $attributes, array $children, bool $selfClosing, bool $directive):
|
解析した情報と元の位置を受け取る |
public
getName(): string
|
この構文で指定された名前を返す |
public
getAttributes(): array
|
元のタグに記述された属性を返す |
public
getChildren(): array
|
記述順の子ノードを返す |
public
isSelfClosing(): bool
|
自己終了タグかどうかを返す |
public
isDirective(): bool
|
ディレクティブとして解析したかを返す |
public
override
toArray(): array
|
構造と元の位置を観測用の配列にまとめる |
継承プロパティ
| 名前 | 型 | 説明 | 継承元 |
|---|---|---|---|
protected
$type
|
string |
ノードの種類 | AbstractNode |
protected
$span
|
SourceSpan |
元のテンプレート内の位置 | AbstractNode |
継承メソッド
| メソッド | 説明 | 継承元 |
|---|---|---|
public
getType(): string
|
構文ノードの種別を返す | AbstractNode |
public
getSpan(): SourceSpan
|
元のテンプレート内の位置を返す | AbstractNode |
protected
buildBasePayload(): array
|
固有の情報へ添える、種別と位置の配列を作る | AbstractNode |