ResultFilter
class ResultFilter
This class is used to filter the results of a query on a data source with the 'return path' defined in the source.
The return path can be a JSONPath or XPath expression, a CSS selector or a line and column number.
Properties
private array | $functions | ||
private array | $phpfunctions |
Methods
Constructor of class ResultFilter
Filters the results of a query on a data source with the 'return path' defined in the source.
Filters the JSON results of a query on a data source with the 'return path' defined in the source.
Filters the CSV results of a query on a data source with the 'return path' defined in the source.
Filters the HTML results of a query on a data source with the 'return path' defined in the source.
Filters the XML results of a query on a data source with the 'return path' defined in the source.
Replaces the php functions in an XPath expression with the syntax required for their executions
Converts an array to a XML DOM document
Converts a true/false (boolean) value to a string
Determines whether the given tag name is valid or not.
Converts an array to a XML DOM node of a DOM document
Replaces all '#text' keys of the given array by the corresponding text
Filters an array with an XPath expression
Filters an XML DOM document with an XPath expression and converts it to an array
Converts an array of SimpleXMLElement to an associative array
Parses a date string according to the given format and returns its timestamp
Details
at line 171
void
__construct()
Constructor of class ResultFilter
at line 188
static mixed|null
filter(string $format, mixed $result, string $path, array $namespaces = array(), string $separator = ",", string $delimiter = "")
Filters the results of a query on a data source with the 'return path' defined in the source.
at line 214
protected array
filterJSON(mixed $json, string $path)
Filters the JSON results of a query on a data source with the 'return path' defined in the source.
The return path is a JSONPath or a XPath expression
at line 241
protected mixed
filterCSV(string $csv, string $path, string $separator, string $delimiter)
Filters the CSV results of a query on a data source with the 'return path' defined in the source.
The return path is in the form "line number/column number"
at line 275
protected array
filterHTML(Crawler $crawler, string $path, array $namespaces = array())
Filters the HTML results of a query on a data source with the 'return path' defined in the source.
The return path is a XPath expression or a CSS selector
at line 308
protected array
filterXML(Crawler $crawler, string $path, array $namespaces = array())
Filters the XML results of a query on a data source with the 'return path' defined in the source.
The return path is a XPath expression
at line 326
protected string
replacePathFunctions(string $path)
Replaces the php functions in an XPath expression with the syntax required for their executions
at line 345
protected DomDocument
createXML(string $node_name, array $arr = array())
Converts an array to a XML DOM document
at line 361
protected string
bool2str(bool $v)
Converts a true/false (boolean) value to a string
at line 375
protected bool
isValidTagName(string $tag)
Determines whether the given tag name is valid or not.
at line 391
protected DOMNode
convertToXML(DomDocument $dom, string $node_name, array $arr = array())
Converts an array to a XML DOM node of a DOM document
at line 457
protected array
createArray(DOMNodeList $xml)
Creates and returns an array from a list of XML DOM node
at line 471
protected void
replaceTextKeys(array $array)
Replaces all '#text' keys of the given array by the corresponding text
at line 512
protected bool
nodeHasChild(DOMNode $node)
Determines whether a DOM node has at least one DOM element as child.
at line 531
protected array
convertToArray(DOMNodeList|DOMNode $xml)
Converts a list of XML DOM node to an array
at line 564
protected array
xPathFilter(string $root, array $array, string $path)
Filters an array with an XPath expression
at line 579
protected array
xPathDOMFilter(DOMDocument $doc, string $path, array $namespaces = array())
Filters an XML DOM document with an XPath expression and converts it to an array
at line 600
static array|string
xml2array(array|object $xml)
Converts an array of SimpleXMLElement to an associative array
at line 634
static int|null
timestamp(string $format, string $dateStr)
Parses a date string according to the given format and returns its timestamp