IndentedCode
extends AbstractStringContainerBlock
in package
Block-level element
Table of Contents
- $data : array<string, mixed>
- Used for storage of arbitrary data.
- $depth : int
- $endLine : int
- $finalStringContents : string
- $firstChild : Node|null
- $lastChild : Node|null
- $lastLineBlank : bool
- $next : Node|null
- $open : bool
- $parent : Node|null
- $previous : Node|null
- $startLine : int
- $strings : ArrayCollection<int, string>
- __clone() : mixed
- Clone the current node and its children
- __construct() : mixed
- Constructor
- addLine() : void
- appendChild() : void
- canContain() : bool
- 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() : mixed
- firstChild() : Node|null
- getData() : mixed
- getDepth() : int
- getEndLine() : int
- getStartLine() : int
- getStringContent() : string
- handleRemainingContents() : void
- hasChildren() : bool
- insertAfter() : void
- Inserts the $sibling node after $this
- insertBefore() : void
- Inserts the $sibling node before $this
- isCode() : bool
- isContainer() : bool
- isOpen() : bool
- Whether the block is open for modifications
- 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
- shouldLastLineBeBlank() : bool
- Determines whether the last line should be marked as blank
- walker() : NodeWalker
- setParent() : void
Properties
$data
Used for storage of arbitrary data.
public
array<string, mixed>
$data
= []
$depth
protected
int
$depth
= 0
$endLine
protected
int
$endLine
= 0
$finalStringContents
protected
string
$finalStringContents
= ''
$firstChild
protected
Node|null
$firstChild
$lastChild
protected
Node|null
$lastChild
$lastLineBlank
protected
bool
$lastLineBlank
= false
$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
$strings
protected
ArrayCollection<int, string>
$strings
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()
Constructor
public
__construct() : mixed
Return values
mixed —addLine()
public
addLine(string $line) : void
Parameters
- $line : string
Return values
void —appendChild()
public
appendChild(Node $child) : void
Parameters
- $child : Node
Return values
void —canContain()
public
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() :
AbstractInline[]
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()
public
finalize(ContextInterface $context, int $endLineNumber) : mixed
Parameters
- $context : ContextInterface
- $endLineNumber : int
Return values
mixed —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 —getStartLine()
public
getStartLine() : int
Return values
int —getStringContent()
public
getStringContent() : string
Return values
string —handleRemainingContents()
public
handleRemainingContents(ContextInterface $context, Cursor $cursor) : void
Parameters
- $context : ContextInterface
- $cursor : Cursor
Return values
void —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()
public
isCode() : bool
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 —lastChild()
public
lastChild() : Node|null
Return values
Node|null —matchesNextLine()
public
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 —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