Methods |
public
|
__construct(array<string, mixed> $attributes = [])
Parameters
$attributes |
Array of attributes
|
Overridden by
|
#
|
public
|
getLine(): int
Gets line the node started in (alias of getStartLine).
Gets line the node started in (alias of getStartLine).
Returns
Start line (or -1 if not available)
Implements
|
#
|
public
|
getStartLine(): int
Gets line the node started in. Requires the 'startLine' attribute to be enabled in the lexer (enabled by default).
Gets line the node started in. Requires the 'startLine' attribute to be enabled in the lexer (enabled by default).
Returns
Start line (or -1 if not available)
Implements
|
#
|
public
|
getEndLine(): int
Gets the line the node ended in. Requires the 'endLine' attribute to be enabled in the lexer (enabled by default).
Gets the line the node ended in. Requires the 'endLine' attribute to be enabled in the lexer (enabled by default).
Returns
End line (or -1 if not available)
Implements
|
#
|
public
|
getStartTokenPos(): int
Gets the token offset of the first token that is part of this node. The offset is an index into the array returned by Lexer::getTokens(). Requires the 'startTokenPos' attribute to be enabled in the lexer (DISABLED by default).
Gets the token offset of the first token that is part of this node. The offset is an index into the array returned by Lexer::getTokens(). Requires the 'startTokenPos' attribute to be enabled in the lexer (DISABLED by default).
Returns
Token start position (or -1 if not available)
Implements
|
#
|
public
|
getEndTokenPos(): int
Gets the token offset of the last token that is part of this node. The offset is an index into the array returned by Lexer::getTokens(). Requires the 'endTokenPos' attribute to be enabled in the lexer (DISABLED by default).
Gets the token offset of the last token that is part of this node. The offset is an index into the array returned by Lexer::getTokens(). Requires the 'endTokenPos' attribute to be enabled in the lexer (DISABLED by default).
Returns
Token end position (or -1 if not available)
Implements
|
#
|
public
|
getStartFilePos(): int
Gets the file offset of the first character that is part of this node. Requires the 'startFilePos' attribute to be enabled in the lexer (DISABLED by default).
Gets the file offset of the first character that is part of this node. Requires the 'startFilePos' attribute to be enabled in the lexer (DISABLED by default).
Returns
File start position (or -1 if not available)
Implements
|
#
|
public
|
getEndFilePos(): int
Gets the file offset of the last character that is part of this node. Requires the 'endFilePos' attribute to be enabled in the lexer (DISABLED by default).
Gets the file offset of the last character that is part of this node. Requires the 'endFilePos' attribute to be enabled in the lexer (DISABLED by default).
Returns
File end position (or -1 if not available)
Implements
|
#
|
public
|
getComments(): Comment[]
Gets all comments directly preceding this node. The comments are also available through the "comments" attribute.
Gets all comments directly preceding this node. The comments are also available through the "comments" attribute.
Implements
|
#
|
public
|
getDocComment(): null|Doc
Gets the doc comment of the node.
Gets the doc comment of the node.
Returns
Doc comment object or null
Implements
|
#
|
public
|
setDocComment(Doc $docComment): void
Sets the doc comment of the node. This will either replace an existing doc comment or add it to the comments array.
Sets the doc comment of the node. This will either replace an existing doc comment or add it to the comments array.
Parameters
$docComment |
Doc comment to set
|
Implements
|
#
|
public
|
setAttribute(string $key, $value): void
Sets an attribute on a node.
Sets an attribute on a node.
Implements
|
#
|
public
|
hasAttribute(string $key): bool
Returns whether an attribute exists.
Returns whether an attribute exists.
Implements
|
#
|
public
|
getAttribute(string $key, $default = null)
Returns the value of an attribute.
Returns the value of an attribute.
Implements
|
#
|
public
|
getAttributes(): array
Returns all the attributes of this node.
Returns all the attributes of this node.
Implements
|
#
|
public
|
setAttributes(array $attributes): void
Replaces all the attributes of this node.
Replaces all the attributes of this node.
Implements
|
#
|
public
|
jsonSerialize(): array<string, mixed>
|
#
|