setasign\SetaPDF2\FormFiller\Xfa

Som The helper class working with SOM expressions.

File: /SetaPDF v2/FormFiller/Xfa/Som.php
Old class name (alias): \SetaPDF_FormFiller_Xfa_Som

Class hierarchy

Summary

Static Methods

escape()

public static Som::escape (
array|string $som
): array|mixed

Escapes dots in a SOM expression.

Parameters
$som : array|string
 

evaluateSomShortcuts()

public static Som::evaluateSomShortcuts (
string $som,
string $dataRoot = 'xfa.datasets.data'
): array|string

Translates SOM shortcuts in a SOM expression to their full names.

Parameters
$som : string
 
$dataRoot : string

Relative root path

Exceptions

Throws \setasign\SetaPDF2\FormFiller\Exception

prepareSomExpression()

public static Som::prepareSomExpression (
string $som
): array

Prepares a SOM expression for further usage.

Parameters
$som : string
 

unescape()

public static Som::unescape (
array|string $som
): array|string

Unescapes characters in a SOM expression.

Parameters
$som : array|string
 

Methods

_evaluateDirectMatch()

protected Som::_evaluateDirectMatch (
string $name,
\DOMElement $context,
array &$result
): void

Evaluates a direct match by ignoring invisible/unnamed nodes.

Parameters
$name : string
 
$context : \DOMElement
 
$result : array
 

_filterNode()

protected Som::_filterNode (
array|\DOMNodeList $nodeList,
mixed $filter
): array

Filters a node list by given filter values.

Actually only numeric offsets or a wildcard filter are available.

Parameters
$nodeList : array|\DOMNodeList
 
$filter : mixed
 
Exceptions

Throws \setasign\SetaPDF2\FormFiller\Exception

evaluate()

public Som::evaluate (
string $som,
\DOMElement|\DOMElement[] $context
): \DOMElement|\DOMElement[]|\DOMAttr|bool

Evaluates a SOM expression in the given context and returs the matched node(s).

Parameters
$som : string
 
$context : \DOMElement|\DOMElement[]
 
Exceptions

Throws \Exception