Resolves $vars
@param $vars
@param $data
@param array $data_pointer
324701
protected function resolveVars(&$vars, &$data, array &$data_pointer = [])
    {
        if (is_object($vars)) {
            if (property_exists($vars, '$ref') && is_string($vars->{'$ref'})) {
                $ref = $vars->{'$ref'};
                $relative = JsonPointer::parseRelativePointer($ref, true);
                if ($relative === null) {
                    $resolved = JsonPointer::getDataByPointer($data, $ref, $this, false);
                } else {
                    if (!JsonPointer::isEscapedPointer($ref)) {
                        throw new InvalidJsonPointerException($ref);
                    }
                    $resolved = JsonPointer::getDataByRelativePointer($data, $relative, $data_pointer, $this);
                }
                if ($resolved === $this) {
                    throw new InvalidJsonPointerException($ref);
                }
                if (is_array($resolved) && property_exists($vars, '$each') && is_object($vars->{'$each'})) {
                    $pointer = $relative['pointer'] ?? [];
                    foreach ($resolved as $index => &$item) {
                        $copy = $this->deepClone($vars->{'$each'});
                        $pointer[] = $index;
                        $this->resolveVars($copy,$data,$pointer);
                        array_pop($pointer);
                        $item = $copy;
                        unset($copy, $item, $index);
                    }
                    unset($pointer);
                }
                $vars = $resolved;
                return;
            }
        } elseif (!is_array($vars)) {
            return;
        }

        foreach ($vars as $name => &$var) {
            if (is_array($var) || is_object($var)) {
                $this->resolveVars($var, $data, $data_pointer);
            }
            unset($var);
        }
    }
827842
public function input($var_name, $options = array())
  {
    $ret = "";

    if($this->inputs[$var_name]['type_datas'][0] == 0) {
      return $this->closed_input($var_name, $options);
    }
    else {
      $ret = $this->input_begin($var_name, $options);
      
      if(key_exists($var_name, $this->values)) 
        $ret .= $this->values[$var_name];

      $ret .= $this->input_end($var_name);
    }

    return $ret;
  }
613022
public function getRedefinedVars(array $new_vars_in_scope, $include_new_vars = false)
    {
        $redefined_vars = [];

        foreach ($this->vars_in_scope as $var_id => $this_type) {
            if (!isset($new_vars_in_scope[$var_id])) {
                if ($include_new_vars) {
                    $redefined_vars[$var_id] = $this_type;
                }
                continue;
            }

            $new_type = $new_vars_in_scope[$var_id];

            if (!$this_type->failed_reconciliation
                && !$this_type->isEmpty()
                && !$new_type->isEmpty()
                && !$this_type->equals($new_type)
            ) {
                $redefined_vars[$var_id] = $this_type;
            }
        }

        return $redefined_vars;
    }
576477
protected function buildJavaScriptSyntax(array $vars)
    {
        foreach ($vars as $key => $value) {
            $this->vars[] = $this->buildVariableInitialization($key, $value);
        }
    }
117180
public function extract(Parser $parser, Node\Variable $var, $data)
    {
        $value   = $data;
        $vals    = array_filter(explode($this->sep, $data));
        $options = $var->options;

        switch ($options['modifier']) {

            case '*':
                $data = array();
                foreach($vals as $val) {

                    if (strpos($val, '=') !== false) {
                        list($k, $v) = explode('=', $val);
                        $data[$k] = $v;
                    }

                    else {
                        $data[]   = $val;
                    }
                }

                break;
            case ':':
                break;
            default:
                $data = strpos($data, $this->sep) !== false ? $vals : $value;

        }

        return $this->decode($parser, $var, $data);
    }
119375
public static function lookup(&$context, $vars) {
        if (isset($vars[0][0]) && ($vars[0][0] === 'lookup')) {
            if (!$context['flags']['nohbh']) {
                if (count($vars) < 2) {
                    $context['error'][] = "No argument after {{lookup}} !";
                } else if (count($vars) < 3) {
                    $context['error'][] = "{{lookup}} requires 2 arguments !";
                }
                $context['usedFeature']['lookup']++;
                return true;
            }
        }
    }
1025938
private function ensurePreviewVars(array $vars, array $uriVars)
    {
        if (! is_user_logged_in()) {
            return $vars;
        }

        foreach (['preview', 'preview_id', 'preview_nonce'] as $var) {
            if (! isset($vars[$var]) && isset($uriVars[$var])) {
                $vars[$var] = $uriVars[$var];
            }
        }

        return $vars;
    }
670380
public void declareVariables(Variable[] vars) {
        for (int i=0; i<vars.length; i++) {
            vars[i] = declareVariable(vars[i]);
        }
    }
396365
public function setTheme(DataSourceViewInterface $dataSource, $theme, array $vars = [])
    {
        $this->themes[$dataSource->getName()] = ($theme instanceof Twig_Template)
            ? $theme
            : $this->environment->loadTemplate($theme);
        $this->themesVars[$dataSource->getName()] = $vars;
    }
473203
public void resolveVariablesWith(Map<String, INDArray> arrays) {
        for (Map.Entry<String,INDArray> e : arrays.entrySet()) {
            SDVariable varForName = getVariable(e.getKey());
            if (varForName == null) {
                throw new ND4JIllegalStateException("No variable name found for " + e.getKey());
            }

            Variable v = variables.get(e.getKey());
            if(varForName.getVariableType() == VariableType.PLACEHOLDER){
                //Check shape:
                long[] shape = varForName.placeholderShape();
                long[] newShape = e.getValue().shape();
                Preconditions.checkState(shape.length == newShape.length, "Placeholder shape not compatible (mismatched rank): placeholder \"%s\" " +
                        "shape %s, got incompatible shape %s", e.getKey(), shape, newShape);
            }
        }


        for (val entry : arrays.entrySet()) {
            if (!variables.get(entry.getKey()).getVariable().isPlaceHolder()) {
                throw new ND4JIllegalStateException("Illegal variable " + entry.getKey() + " passed in. Variable found not to be a place holder variable");
            }

            val specifiedShape = getOriginalShapeForPlaceHolder(entry.getKey());
            //whole shape was specified: validate whether the input array shape is equal
            if (!Shape.isPlaceholderShape(specifiedShape)) {
                if (!Shape.shapeEquals(specifiedShape, entry.getValue().shape())) {
                    throw new ND4JIllegalStateException("Place holder shape specified was " + Arrays.toString(specifiedShape) + " but array shape was " + Arrays.toString(entry.getValue().shape()));
                }
            }

            associateArrayWithVariable(entry.getValue(), getVariable(entry.getKey()));
            setArrayForVariable(entry.getKey(), entry.getValue());
        }

        //declare resolved
        resolvedVariables = true;
    }
880739
public function setFromArray(array $vars, bool $cast = true): void
    {
        if ($cast) {
            foreach ($vars as $key => $val) {
                if (property_exists($this, $key)) {
                    if (is_int($this->$key)) {
                        $this->$key = (int) $val;
                    } elseif (is_string($this->$key)) {
                        $this->$key = (string) $val;
                    } elseif (is_bool($this->$key)) {
                        $this->$key = (bool) $val;
                    } elseif (is_float($this->$key)) {
                        $this->$key = (float) $val;
                    } else {
                        $this->$key = $val;
                    }
                }
            }
        } else {
            foreach ($vars as $key => $val) {
                if (property_exists($this, $key)) {
                    $this->$key = $val;
                }
            }
        }
    }
406317
public static function nulls(array $data, $keys = null)
    {
        if ($keys === null) {
            $keys = array_keys($data);
        }

        if (!Arrays::isArray($keys)) {
            $keys = array($keys);
        }

        foreach ($keys as $key) {
            if (array_key_exists($key, $data) && empty($data[$key])) {
                $data[$key] = null;
            }
        }

        return $data;
    }
357505
public function init($vars) {
		foreach($vars as $n => $v) {
			if($n == 'db') self::$db = $v;
			else if($n == 'error') self::$e = $v;
			else self::$add[$n] = $v;
		}
	}
611527
public function setVars($vars)
    {
        // If vars is an array
        if (is_array($vars) && count($vars)) {
            // Iterate and set the var
            foreach ($vars as $key => $value) {
                $this->setVar($key, $value);
            }
        }
        return $this;
    }
1079588
function(vars, listener) {
            if (!Array.isArray(vars)) {
                vars = [vars];
            }
            if (vars.length == 0) return null;
            var found = false;
            vars.forEach(
                function(name) {
                    var data = this.findDataBinding(name);
                    var i, target;
                    for (i = 0 ; i < data[1].length ; i++) {
                        target = data[1][i];
                        if (listener === target) {
                            data[1].splice(i, 1);
                            found = true;
                            return;
                        }
                    }
                }, this
            );
            return found;
        }
438228
public function getBindingsAsVars( $vars = array() )
	{
		// $vars = array_merge( $existingVars, $this->parameters );
		$vars = $this->getParametersAsVars( $vars );

		foreach( $this->factVariableBindings as $bindingQName => /** @var \XBRL\Formulas\factVariableBinding $varBinding */ $varBinding )
		{
			if ( $varBinding->isFallback )
			{
				$current = $varBinding->yieldedFact;
			}
			else
			{
				// Using current makes sure the fact is set and the binding variables are correct
				if ( ! $varBinding->valid() ) $varBinding->rewind();
				$current = $varBinding->current();
			}
			if ( $current instanceof XPath2NodeIterator ) $current->Reset();
			$vars[ $bindingQName ] = $current;
			$vars = array_merge( $vars, $varBinding->getAdditionalVars() );
		}

		foreach( $this->generalVariableBindings as $bindingQName => /** @var VariableBinding $varBinding */ $varBinding )
		{
			// Using current makes sure the fact is set and the binding variables are correct
			// $vars[ $bindingQName ] = $this->variablesByQName[ $bindingQName ]->bindAsSequence ? $varBinding->facts : $varBinding->current();
			if ( ! $varBinding->valid() ) $varBinding->rewind();
			$current = $varBinding->current();
			if ( $current instanceof XPath2NodeIterator )
			{
				// BMS 2018-04-04 Test 0023 V-03 fails because the vars are being reset presumably because a var is not a clone
				$current = $current->CloneInstance();
				$current->Reset();
			}
			else if ( $current instanceof XPathNavigator)
			{
				$current = $current->CloneInstance();
			}
			$vars[ $bindingQName ] = $current;
		}

		return $vars;
	}
108025
public static function partial(&$context, $vars) {
        Parser::getBlockParams($vars);
        $pid = Parser::getPartialBlock($vars);
        $p = array_shift($vars);
        if ($context['flags']['runpart']) {
            if (!isset($vars[0])) {
                $vars[0] = $context['flags']['partnc'] ? array(0, 'null') : array();
            }
            $v = static::getVariableNames($context, $vars);
            $tag = ">$p[0] " .implode(' ', $v[1]);
            if (Parser::isSubExp($p)) {
                list($p) = static::compileSubExpression($context, $p[1]);
            } else {
                $p = "'$p[0]'";
            }
            $sp = $context['tokens']['partialind'] ? ", '{$context['tokens']['partialind']}'" : '';
            return $context['ops']['seperator'] . static::getFuncName($context, 'p', $tag) . "\$cx, $p, $v[0],$pid$sp){$context['ops']['seperator']}";
        }
        return isset($context['usedPartial'][$p[0]]) ? "{$context['ops']['seperator']}'" . Partial::compileStatic($context, $p[0]) . "'{$context['ops']['seperator']}" : $context['ops']['seperator'];
    }