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 170
void
__construct()
Constructor of class ResultFilter
at line 187
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 213
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 237
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 271
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 304
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 322
protected string
replacePathFunctions(string $path)
Replaces the php functions in an XPath expression with the syntax required for their executions
at line 341
protected DomDocument
createXML(string $node_name, array $arr = array())
Converts an array to a XML DOM document
at line 357
protected string
bool2str(bool $v)
Converts a true/false (boolean) value to a string
at line 371
protected bool
isValidTagName(string $tag)
Determines whether the given tag name is valid or not.
at line 387
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 453
protected array
createArray(DOMNodeList $xml)
Creates and returns an array from a list of XML DOM node
at line 467
protected void
replaceTextKeys(array $array)
Replaces all '#text' keys of the given array by the corresponding text
at line 502
protected bool
nodeHasChild(DOMNode $node)
Determines whether a DOM node has at least one DOM element as child.
at line 521
protected array
convertToArray(DOMNodeList|DOMNode $xml)
Converts a list of XML DOM node to an array
at line 554
protected array
xPathFilter(string $root, array $array, string $path)
Filters an array with an XPath expression
at line 569
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 590
static array|string
xml2array(array $xml)
Converts an array of SimpleXMLElement to an associative array
at line 624
static int|null
timestamp(string $format, string $dateStr)
Parses a date string according to the given format and returns its timestamp