18declare(strict_types=1);
40 $context_size = count($context_asc);
41 if (2 > $context_size) {
44 return in_array($context_asc[$context_size - 2], $search_any,
true);
57 $search_size = count($search_exactly);
58 if (0 === $search_size || $search_size + 1 > count($context_asc)) {
61 $ancestors = array_slice($context_asc, 0, -1);
62 return $search_exactly === array_slice($ancestors, -$search_size);
75 if (3 > count($context_asc)) {
78 $indirect_ancestors = array_slice($context_asc, 0, -2);
79 return [] !== array_intersect($indirect_ancestors, $search_any);
92 $search_size = count($search_exactly);
93 if (0 === $search_size || $search_size + 2 > count($context_asc)) {
96 $indirect_ancestors = array_slice($context_asc, 0, -2);
97 $last_start = count($indirect_ancestors) - $search_size;
98 for ($start = 0; $last_start >= $start; $start++) {
99 if ($search_exactly === array_slice($indirect_ancestors, $start, $search_size)) {
Searches for patterns inside the given rendering context in order to apply context rendering.
isIndirectDescendantOf(array $context_asc, array $search_exactly)
Returns true the exact canonical names of $search_exactly are indirect ancestors of the last canonica...
isIndirectDescendantOfAny(array $context_asc, array $search_any)
Returns true if any canonical name of $search_any is an indirect ancestor of the last canonical name ...
isDescendantOfAny(array $context_asc, array $search_any)
Returns true if any canonical name of $search_any is an ancestor of any kind of the last canonical na...
isDirectDescendantOfAny(array $context_asc, array $search_any)
Returns true if any canonical name of $search_any is a direct ancestor of the last canonical name ins...
isDirectDescendantOf(array $context_asc, array $search_exactly)
Returns true the exact canonical names of $search_exactly are direct ancestors of the last canonical ...
isDescendantOf(array $context_asc, array $search_exactly)
Returns true the exact canonical names of $search_exactly are indirect ancestors of any kind of the l...