You are here

protected function FeedsExJmesPath::search in Feeds extensible parsers 7

Returns data from the input array that matches a JMESPath expression.

Parameters

string $expression: JMESPath expression to evaluate.

mixed $data: JSON-like data to search.

Return value

mixed|null Returns the matching data or null.

3 calls to FeedsExJmesPath::search()
FeedsExJmesPath::executeContext in src/FeedsExJmesPath.inc
Returns rows to be parsed.
FeedsExJmesPath::executeSourceExpression in src/FeedsExJmesPath.inc
Executes a single source expression.
FeedsExJmesPath::validateExpression in src/FeedsExJmesPath.inc
Validates an expression.

File

src/FeedsExJmesPath.inc, line 100
Contains FeedsExJmesPath.

Class

FeedsExJmesPath
Parses JSON documents with JMESPath.

Code

protected function search($expression, $data) {
  if (!isset($this->runtime)) {
    $this->runtime = $this
      ->createRuntime($this
      ->getCompileDirectory());
  }

  // Stupid PHP.
  $runtime = $this->runtime;
  return $runtime($expression, $data);
}