JmesPath\TreeCompiler::visit_field PHP Method

visit_field() private method

private visit_field ( array $node )
$node array
    private function visit_field(array $node)
    {
        $arr = '$value[' . var_export($node['value'], true) . ']';
        $obj = '$value->{' . var_export($node['value'], true) . '}';
        $this->write('if (is_array($value) || $value instanceof \\ArrayAccess) {')->indent()->write('$value = isset(%s) ? %s : null;', $arr, $arr)->outdent()->write('} elseif ($value instanceof \\stdClass) {')->indent()->write('$value = isset(%s) ? %s : null;', $obj, $obj)->outdent()->write("} else {")->indent()->write('$value = null;')->outdent()->write("}");
        return $this;
    }