TableOfContents
extends ListBlock
in package
Block-level element
Tags
Table of Contents
- TYPE_BULLET = 'bullet'
- TYPE_ORDERED = 'ordered'
- TYPE_UNORDERED = self::TYPE_BULLET
- $data : array<string, mixed>
- Used for storage of arbitrary data.
- $depth : int
- $endLine : int
- $firstChild : Node|null
- $lastChild : Node|null
- $lastLineBlank : bool
- $listData : ListData
- $next : Node|null
- $open : bool
- $parent : Node|null
- $previous : Node|null
- $startLine : int
- $tight : bool
- __clone() : mixed
- Clone the current node and its children
- __construct() : mixed
- appendChild() : void
- canContain() : bool
- Returns true if this block can contain the given block as a child node
- children() : array<string|int, Node>
- children() :
- detach() : void
- detachChildren() : void
- Detaches all child nodes of given node
- endsWithBlankLine() : bool
- Whether the block ends with a blank line
- finalize() : void
- Finalize the block; mark it closed for modification
- firstChild() : Node|null
- getData() : mixed
- getDepth() : int
- getEndLine() : int
- getListData() : ListData
- getStartLine() : int
- hasChildren() : bool
- insertAfter() : void
- Inserts the $sibling node after $this
- insertBefore() : void
- Inserts the $sibling node before $this
- isCode() : bool
- Whether this is a code block
- isContainer() : bool
- isOpen() : bool
- Whether the block is open for modifications
- isTight() : bool
- lastChild() : Node|null
- matchesNextLine() : bool
- next() : Node|null
- parent() : Node|null
- parent() :
- prependChild() : void
- Adds $child as the very first child of $this
- previous() : Node|null
- replaceChildren() : $this
- Replace all children of given node with collection of another
- replaceWith() : void
- setEndLine() : $this
- setLastLineBlank() : void
- setStartLine() : $this
- setTight() : self
- shouldLastLineBeBlank() : bool
- Determines whether the last line should be marked as blank
- walker() : NodeWalker
- setParent() : void
Constants
TYPE_BULLET
public
mixed
TYPE_BULLET
= 'bullet'
TYPE_ORDERED
public
mixed
TYPE_ORDERED
= 'ordered'
TYPE_UNORDERED
public
mixed
TYPE_UNORDERED
= self::TYPE_BULLET
Tags
Properties
$data
Used for storage of arbitrary data.
public
array<string, mixed>
$data
= []
$depth
protected
int
$depth
= 0
$endLine
protected
int
$endLine
= 0
$firstChild
protected
Node|null
$firstChild
$lastChild
protected
Node|null
$lastChild
$lastLineBlank
protected
bool
$lastLineBlank
= false
$listData
protected
ListData
$listData
$next
protected
Node|null
$next
$open
protected
bool
$open
= true
$parent
protected
Node|null
$parent
$previous
protected
Node|null
$previous
$startLine
protected
int
$startLine
= 0
$tight
protected
bool
$tight
= false
Methods
__clone()
Clone the current node and its children
public
__clone() : mixed
WARNING: This is a recursive function and should not be called on deeply-nested node trees!
Return values
mixed —__construct()
public
__construct(ListData $listData) : mixed
Parameters
- $listData : ListData
Return values
mixed —appendChild()
public
appendChild(Node $child) : void
Parameters
- $child : Node
Return values
void —canContain()
Returns true if this block can contain the given block as a child node
public
abstract canContain(AbstractBlock $block) : bool
Parameters
- $block : AbstractBlock
Return values
bool —children()
public
children() : array<string|int, Node>
Return values
array<string|int, Node> —children()
public
children() :
AbstractBlock[]
Return values
—detach()
public
detach() : void
Return values
void —detachChildren()
Detaches all child nodes of given node
public
detachChildren() : void
Return values
void —endsWithBlankLine()
Whether the block ends with a blank line
public
endsWithBlankLine() : bool
Return values
bool —finalize()
Finalize the block; mark it closed for modification
public
finalize(ContextInterface $context, int $endLineNumber) : void
Parameters
- $context : ContextInterface
- $endLineNumber : int
Return values
void —firstChild()
public
firstChild() : Node|null
Return values
Node|null —getData()
public
getData(string $key[, mixed $default = null ]) : mixed
Parameters
- $key : string
- $default : mixed = null
Return values
mixed —getDepth()
public
getDepth() : int
Return values
int —getEndLine()
public
getEndLine() : int
Return values
int —getListData()
public
getListData() : ListData
Return values
ListData —getStartLine()
public
getStartLine() : int
Return values
int —hasChildren()
public
hasChildren() : bool
Return values
bool —insertAfter()
Inserts the $sibling node after $this
public
insertAfter(Node $sibling) : void
Parameters
- $sibling : Node
Return values
void —insertBefore()
Inserts the $sibling node before $this
public
insertBefore(Node $sibling) : void
Parameters
- $sibling : Node
Return values
void —isCode()
Whether this is a code block
public
abstract isCode() : bool
Code blocks are extra-greedy - they'll try to consume all subsequent lines of content without calling matchesNextLine() each time.
Return values
bool —isContainer()
public
abstract isContainer() : bool
Return values
bool —isOpen()
Whether the block is open for modifications
public
isOpen() : bool
Return values
bool —isTight()
public
isTight() : bool
Return values
bool —lastChild()
public
lastChild() : Node|null
Return values
Node|null —matchesNextLine()
public
abstract matchesNextLine(Cursor $cursor) : bool
Parameters
- $cursor : Cursor
Return values
bool —next()
public
next() : Node|null
Return values
Node|null —parent()
public
parent() : Node|null
Return values
Node|null —parent()
public
parent() :
?AbstractBlock
Return values
—prependChild()
Adds $child as the very first child of $this
public
prependChild(Node $child) : void
Parameters
- $child : Node
Return values
void —previous()
public
previous() : Node|null
Return values
Node|null —replaceChildren()
Replace all children of given node with collection of another
public
replaceChildren(iteratable<string|int, Node> $children) : $this
Parameters
- $children : iteratable<string|int, Node>
Return values
$this —replaceWith()
public
replaceWith(Node $replacement) : void
Parameters
- $replacement : Node
Return values
void —setEndLine()
public
setEndLine(int $endLine) : $this
Parameters
- $endLine : int
Return values
$this —setLastLineBlank()
public
setLastLineBlank(bool $blank) : void
Parameters
- $blank : bool
Return values
void —setStartLine()
public
setStartLine(int $startLine) : $this
Parameters
- $startLine : int
Return values
$this —setTight()
public
setTight(bool $tight) : self
Parameters
- $tight : bool
Return values
self —shouldLastLineBeBlank()
Determines whether the last line should be marked as blank
public
shouldLastLineBeBlank(Cursor $cursor, int $currentLineNumber) : bool
Parameters
- $cursor : Cursor
- $currentLineNumber : int
Return values
bool —walker()
public
walker() : NodeWalker
Return values
NodeWalker —setParent()
protected
setParent([Node|null $node = null ]) : void
Parameters
- $node : Node|null = null