GridTableBuilder
in package
uses
ReportsViolations
FinalYes
Table of Contents
Properties
- $logger : LoggerInterface|ViolationReporter
Methods
- __construct() : mixed
- buildNode() : TableNode|null
- compile() : TableNode
- Finds the cells of the table as rectangles of borders, the way docutils does: each cell starts at a "+" corner and ends at the first "+" to the right, below and on the way back that close a rectangle. The row and column of a cell, and how many rows and columns it spans, follow from where its borders lie among the borders of all cells.
- buildColumn() : TableColumn
- buildRow() : TableRow
- cellContent() : string
- isBottomBorder() : bool
- reportViolation() : void
- scanCell() : array{int, int}|null
- scanCells() : array<int, array{int, int, int, int}>
- scanDown() : int|null
- separators() : array<int, int>
- Numbers the borders that cells start or end at, in the order they appear in.
Properties
$logger read-only
private
LoggerInterface|ViolationReporter
$logger
Methods
__construct()
public
__construct(LoggerInterface|ViolationReporter $logger) : mixed
Parameters
- $logger : LoggerInterface|ViolationReporter
buildNode()
public
buildNode(ParserContext $tableParserContext, BlockContext $blockContext, RuleContainer $productions) : TableNode|null
Parameters
- $tableParserContext : ParserContext
- $blockContext : BlockContext
- $productions : RuleContainer
Return values
TableNode|nullcompile()
Finds the cells of the table as rectangles of borders, the way docutils does: each cell starts at a "+" corner and ends at the first "+" to the right, below and on the way back that close a rectangle. The row and column of a cell, and how many rows and columns it spans, follow from where its borders lie among the borders of all cells.
protected
compile(ParserContext $context) : TableNode
Parameters
- $context : ParserContext
Return values
TableNodebuildColumn()
private
buildColumn(TableColumn $col, BlockContext $blockContext, RuleContainer $productions, int $lineOffset) : TableColumn
Parameters
- $col : TableColumn
- $blockContext : BlockContext
- $productions : RuleContainer
- $lineOffset : int
Return values
TableColumnbuildRow()
private
buildRow(TableRow $row, BlockContext $blockContext, RuleContainer $productions, int $lineOffset) : TableRow
Parameters
- $row : TableRow
- $blockContext : BlockContext
- $productions : RuleContainer
- $lineOffset : int
Return values
TableRowcellContent()
private
cellContent(array<int, array<int, string>> $grid, int $top, int $left, int $bottom, int $right) : string
Parameters
- $grid : array<int, array<int, string>>
- $top : int
- $left : int
- $bottom : int
- $right : int
Return values
stringisBottomBorder()
private
isBottomBorder(array<int, array<int, string>> $grid, int $top, int $left, int $bottom, int $right) : bool
Parameters
- $grid : array<int, array<int, string>>
- $top : int
- $left : int
- $bottom : int
- $right : int
Return values
boolreportViolation()
private
reportViolation(LoggerInterface|ViolationReporter|null $reporter, Violation $violation) : void
Parameters
- $reporter : LoggerInterface|ViolationReporter|null
- $violation : Violation
scanCell()
private
scanCell(array<int, array<int, string>> $grid, int $top, int $left) : array{int, int}|null
Parameters
- $grid : array<int, array<int, string>>
- $top : int
- $left : int
Return values
array{int, int}|null —the bottom and right border of the cell starting at this corner
scanCells()
private
scanCells(array<int, array<int, string>> $grid, ParserContext $context) : array<int, array{int, int, int, int}>
Parameters
- $grid : array<int, array<int, string>>
- $context : ParserContext
Return values
array<int, array{int, int, int, int}> —the top, left, bottom and right border of each cell
scanDown()
private
scanDown(array<int, array<int, string>> $grid, int $top, int $left, int $right) : int|null
Parameters
- $grid : array<int, array<int, string>>
- $top : int
- $left : int
- $right : int
Return values
int|nullseparators()
Numbers the borders that cells start or end at, in the order they appear in.
private
separators(array<int, array{int, int, int, int}> $cells, int $start, int $end) : array<int, int>
Parameters
- $cells : array<int, array{int, int, int, int}>
- $start : int
- $end : int
Return values
array<int, int> —the number of each border, by its position