DirectiveNode
extends CompoundNode
in package
FinalYes
Table of Contents
Properties
- $classes : array<string|int, string>
- $options : array<string, scalar|array<string|int, scalar>|null>
- $value : TValue
- $directive : Directive
- $rawContent : string
- $sourceLocation : DirectiveSourceLocation
Methods
- __construct() : mixed
- addChildNode() : void
- getChildren() : array<string|int, TValue>
- getClasses() : array<string|int, string>
- getClassesString() : string
- getDirective() : Directive
- getOption() : mixed
- getOptions() : array<string, scalar|array<string|int, scalar>|null>
- getRawContent() : string
- getSourceLocation() : DirectiveSourceLocation
- getValue() : TValue
- hasOption() : bool
- pushChildNode() : void
- removeNode() : TValue>
- replaceNode() : TValue>
- setClasses() : void
- Normalizes class names following the rules of identifier-normalization
- setSourceLocation() : void
- Set once the directive's content has been fully parsed -- available to createNode() for directives that need to log a warning about their own content, since createNode() itself has no access to BlockContext.
- setValue() : void
- withKeepExistingOptions() : static
- Adds $options as default options without overriding any options already set.
- withOptions() : static
Properties
$classes
protected
array<string|int, string>
$classes
= []
$options
protected
array<string, scalar|array<string|int, scalar>|null>
$options
= []
$value
protected
TValue
$value
$directive read-only
private
Directive
$directive
$rawContent read-only
private
string
$rawContent
= ''
$sourceLocation
private
DirectiveSourceLocation
$sourceLocation
Methods
__construct()
public
__construct(Directive $directive[, array<string|int, Node> $children = [] ][, string $rawContent = '' ]) : mixed
Parameters
- $directive : Directive
- $children : array<string|int, Node> = []
- $rawContent : string = ''
-
the directive's content exactly as written, before it was parsed into $children -- available to createNode() for directives that need the literal source text (e.g. raw passthrough) rather than (or alongside) the parsed node tree
addChildNode()
public
addChildNode(TValue $node) : void
Parameters
- $node : TValue
getChildren()
public
getChildren() : array<string|int, TValue>
Return values
array<string|int, TValue>getClasses()
public
getClasses() : array<string|int, string>
Return values
array<string|int, string>getClassesString()
public
getClassesString() : string
Return values
stringgetDirective()
public
getDirective() : Directive
Return values
DirectivegetOption()
public
getOption(string $name[, TType|null $default = null ]) : mixed
Parameters
- $name : string
- $default : TType|null = null
Tags
getOptions()
public
getOptions() : array<string, scalar|array<string|int, scalar>|null>
Return values
array<string, scalar|array<string|int, scalar>|null>getRawContent()
public
getRawContent() : string
Return values
stringgetSourceLocation()
public
getSourceLocation() : DirectiveSourceLocation
Return values
DirectiveSourceLocationgetValue()
public
getValue() : TValue
Return values
TValuehasOption()
public
hasOption(string $name) : bool
Parameters
- $name : string
Return values
boolpushChildNode()
public
pushChildNode(TValue $node) : void
Parameters
- $node : TValue
removeNode()
public
removeNode(int $key) : TValue>
Parameters
- $key : int
Return values
TValue>replaceNode()
public
replaceNode(int $key, TValue $node) : TValue>
Parameters
- $key : int
- $node : TValue
Return values
TValue>setClasses()
Normalizes class names following the rules of identifier-normalization
public
setClasses(array<string|int, string> $classes) : void
Parameters
- $classes : array<string|int, string>
Tags
setSourceLocation()
Set once the directive's content has been fully parsed -- available to createNode() for directives that need to log a warning about their own content, since createNode() itself has no access to BlockContext.
public
setSourceLocation(DirectiveSourceLocation $sourceLocation) : void
Parameters
- $sourceLocation : DirectiveSourceLocation
setValue()
public
setValue(TValue $value) : void
Parameters
- $value : TValue
withKeepExistingOptions()
Adds $options as default options without overriding any options already set.
public
withKeepExistingOptions(array<string, scalar|null> $options) : static
Parameters
- $options : array<string, scalar|null>
Return values
staticwithOptions()
public
withOptions(array<string, scalar|array<string|int, scalar>|null> $options) : static
Parameters
- $options : array<string, scalar|array<string|int, scalar>|null>