protected function FeedsExJsonPath::executeSourceExpression in Feeds extensible parsers 7
Same name and namespace in other branches
- 7.2 src/FeedsExJsonPath.inc \FeedsExJsonPath::executeSourceExpression()
Executes a single source expression.
Parameters
string $machine_name: The source machine name being executed.
string $expression: The expression to execute.
mixed $row: The row to execute on.
Return value
scalar|[]scalar Either a scalar, or a list of scalars. If null, the value will be ignored.
Overrides FeedsExBase::executeSourceExpression
1 method overrides FeedsExJsonPath::executeSourceExpression()
- FeedsExJsonPathLines::executeSourceExpression in src/
FeedsExJsonPathLines.inc - Executes a single source expression.
File
- src/
FeedsExJsonPath.inc, line 54 - Contains FeedsExJsonPath.
Class
- FeedsExJsonPath
- Parses JSON via JSONPath.
Code
protected function executeSourceExpression($machine_name, $expression, $row) {
$result = $this
->getParser()
->search($row, $expression);
if (is_scalar($result)) {
return $result;
}
// Return a single value if there's only one value.
return count($result) === 1 ? reset($result) : $result;
}