SelectorParser
in package
Table of Contents
Properties
Methods
- __construct() : mixed
- matchesNthChild() : bool
- Evaluate nth-child CSS selector.
- parseCascadedSelector() : array<string|int, mixed>
- Parse cascaded selector (depth > 1).
- parsePageSelector() : string
- Parse @PAGE selector.
- parseSimpleSelector() : string|null
- Parse simple selector (depth 1).
Properties
$mpdf
private
Mpdf
$mpdf
Methods
__construct()
public
__construct(Mpdf $mpdf) : mixed
Parameters
- $mpdf : Mpdf
matchesNthChild()
Evaluate nth-child CSS selector.
public
matchesNthChild(array<string|int, mixed> $nthComponents, int $index) : bool
Determines if a given element index matches an nth-child selector formula. Supports formulas like "2n+1", "odd", "even", or specific numbers.
Parameters
- $nthComponents : array<string|int, mixed>
-
Formula components from preg_match (e.g. 2N+1 split into a preg_match array))
- $index : int
-
Current element index (e.g row or column number)
Return values
bool —True if element matches the nth-child selector
parseCascadedSelector()
Parse cascaded selector (depth > 1).
public
parseCascadedSelector(array<string|int, mixed> $tags) : array<string|int, mixed>
Parameters
- $tags : array<string|int, mixed>
-
Selector tags array
Return values
array<string|int, mixed> —Array of tag levels for cascade
parsePageSelector()
Parse @PAGE selector.
public
parsePageSelector(array<string|int, mixed> $tags) : string
Parameters
- $tags : array<string|int, mixed>
-
Selector tags array
Return values
string —Matches tag
parseSimpleSelector()
Parse simple selector (depth 1).
public
parseSimpleSelector(array<string|int, mixed> $tags) : string|null
Parameters
- $tags : array<string|int, mixed>
-
Selector tags array
Return values
string|null —Parsed tag key or null if invalid