JmesPath\TreeCompiler::visit_multi_select_hash PHP Method

visit_multi_select_hash() private method

private visit_multi_select_hash ( array $node )
$node array
    private function visit_multi_select_hash(array $node)
    {
        $listVal = $this->makeVar('list');
        $value = $this->makeVar('prev');
        $this->write('if ($value !== null) {')->indent()->write('%s = [];', $listVal)->write('%s = $value;', $value);
        $first = true;
        foreach ($node['children'] as $child) {
            if (!$first) {
                $this->write('$value = %s;', $value);
            }
            $first = false;
            if ($node['type'] == 'multi_select_hash') {
                $this->dispatch($child['children'][0]);
                $key = var_export($child['value'], true);
                $this->write('%s[%s] = $value;', $listVal, $key);
            } else {
                $this->dispatch($child);
                $this->write('%s[] = $value;', $listVal);
            }
        }
        return $this->write('$value = %s;', $listVal)->outdent()->write('}');
    }