You are here

protected function JmesPathParser::search in Feeds extensible parsers 8

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 JmesPathParser::search()
JmesPathParser::executeContext in src/Feeds/Parser/JmesPathParser.php
Returns rows to be parsed.
JmesPathParser::executeSourceExpression in src/Feeds/Parser/JmesPathParser.php
Executes a single source expression.
JmesPathParser::validateExpression in src/Feeds/Parser/JmesPathParser.php
Validates an expression.

File

src/Feeds/Parser/JmesPathParser.php, line 78

Class

JmesPathParser
Defines a JSON parser using JMESPath.

Namespace

Drupal\feeds_ex\Feeds\Parser

Code

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

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