FieldListRule
in package
implements
Rule
FinalYes
Tags
Table of Contents
Interfaces
Constants
- PRIORITY = 20
Properties
- $fieldListItemRules : iterable<string|int, mixed>
- $productions : RuleContainer
Methods
- __construct() : mixed
- applies() : bool
- apply() : TNode|null
- Enters this state and loops through all relevant lines until a Node is produced.
- addMetadata() : void
- createDefinition() : void
- createListItem() : FieldListItemNode
- isFieldLine() : bool
- parseField() : array<string|int, string>
Constants
PRIORITY
public
mixed
PRIORITY
= 20
Properties
$fieldListItemRules read-only
private
iterable<string|int, mixed>
$fieldListItemRules
$productions read-only
private
RuleContainer
$productions
Methods
__construct()
public
__construct(RuleContainer $productions, array<string|int, FieldListItemRule> $fieldListItemRules) : mixed
Parameters
- $productions : RuleContainer
- $fieldListItemRules : array<string|int, FieldListItemRule>
applies()
public
applies(BlockContext $blockContext) : bool
Parameters
- $blockContext : BlockContext
Return values
boolapply()
Enters this state and loops through all relevant lines until a Node is produced.
public
apply(BlockContext $blockContext[, CompoundNode|null $on = null ]) : TNode|null
The opening line is considered relevant and as such is always used (this is found the case in the self::Applies() method, otherwise we wouldn't have been here) but for all subsequent lines we use a Look Ahead to test whether it should be included in the Node.
By using a Look Ahead, we prevent the cursor from advancing; and this caused the cursor to 'rest' on the line that is considered that last relevant line. The document parser will advance the line after successfully parsing this and to send the Parser into a line that belongs to another state.
Parameters
- $blockContext : BlockContext
- $on : CompoundNode|null = null
Return values
TNode|nulladdMetadata()
private
addMetadata(DocumentNode $documentNode, array<string|int, FieldListItemNode> $fieldListItemNodes, BlockContext $blockContext) : void
Parameters
- $documentNode : DocumentNode
- $fieldListItemNodes : array<string|int, FieldListItemNode>
- $blockContext : BlockContext
createDefinition()
private
createDefinition(BlockContext $blockContext, string $firstLine, FieldListItemNode $fieldListItemNode) : void
Parameters
- $blockContext : BlockContext
- $firstLine : string
- $fieldListItemNode : FieldListItemNode
createListItem()
private
createListItem(BlockContext $blockContext) : FieldListItemNode
Parameters
- $blockContext : BlockContext
Return values
FieldListItemNodeisFieldLine()
private
static isFieldLine(string|null $currentLine) : bool
Parameters
- $currentLine : string|null
Return values
boolparseField()
private
parseField(string $line) : array<string|int, string>
Parameters
- $line : string