SimpleTableRule
in package
implements
Rule
uses
ReportsViolations
FinalYes
Table of Contents
Interfaces
Constants
- PRIORITY : mixed = 40
Properties
- $logger : LoggerInterface|ViolationReporter
- $productions : RuleContainer
Methods
- __construct() : mixed
- applies() : bool
- apply() : TNode|null
- Enters this state and loops through all relevant lines until a Node is produced.
- applyColumnSpans() : array<int, array{start: int, length: int|null, colspan: int}>
- Merges the cells that a segment of the column span underline covers into one cell.
- checkGaps() : void
- createColumn() : TableColumn
- getColumnDefinition() : array<string|int, array{start: int, length: int|null}>
- isColspanDefinition() : bool
- isColumnDefinitionLine() : bool
- reportViolation() : void
- startsWithBlankCell() : bool
- tryParseRow() : TableRow
Constants
PRIORITY
public
mixed
PRIORITY
= 40
Properties
$logger read-only
private
LoggerInterface|ViolationReporter
$logger
$productions read-only
private
RuleContainer
$productions
Methods
__construct()
public
__construct(RuleContainer $productions, LoggerInterface|ViolationReporter $logger) : mixed
Parameters
- $productions : RuleContainer
- $logger : LoggerInterface|ViolationReporter
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
Parameters
- $blockContext : BlockContext
- $on : CompoundNode|null = null
Return values
TNode|nullapplyColumnSpans()
Merges the cells that a segment of the column span underline covers into one cell.
private
applyColumnSpans(BlockContext $blockContext, array<int, array{start: int, length: int|null, colspan: int}> $cells, string $underline) : array<int, array{start: int, length: int|null, colspan: int}>
Parameters
- $blockContext : BlockContext
- $cells : array<int, array{start: int, length: int|null, colspan: int}>
- $underline : string
Return values
array<int, array{start: int, length: int|null, colspan: int}>checkGaps()
private
checkGaps(BlockContext $blockContext, array<int, array{start: int, length: int|null, colspan: int}> $cells, string $line) : void
Parameters
- $blockContext : BlockContext
- $cells : array<int, array{start: int, length: int|null, colspan: int}>
- $line : string
createColumn()
private
createColumn(string $content, BlockContext $blockContext, int $colspan, int $lineOffset) : TableColumn
Parameters
- $content : string
- $blockContext : BlockContext
- $colspan : int
- $lineOffset : int
Return values
TableColumngetColumnDefinition()
private
getColumnDefinition(string $line) : array<string|int, array{start: int, length: int|null}>
Parameters
- $line : string
Return values
array<string|int, array{start: int, length: int|null}>isColspanDefinition()
private
isColspanDefinition(string|null $line) : bool
Parameters
- $line : string|null
Return values
boolisColumnDefinitionLine()
private
isColumnDefinitionLine(string $line) : bool
Parameters
- $line : string
Return values
boolreportViolation()
private
reportViolation(LoggerInterface|ViolationReporter|null $reporter, Violation $violation) : void
Parameters
- $reporter : LoggerInterface|ViolationReporter|null
- $violation : Violation
startsWithBlankCell()
private
startsWithBlankCell(LinesIterator $documentIterator, array{start: int, length: int|null} $columnDefinition) : bool
Parameters
- $documentIterator : LinesIterator
- $columnDefinition : array{start: int, length: int|null}
Return values
booltryParseRow()
private
tryParseRow(BlockContext $blockContext, array<string|int, array{start: int, length: int|null}> $columnDefinitions) : TableRow
Parameters
- $blockContext : BlockContext
- $columnDefinitions : array<string|int, array{start: int, length: int|null}>