Function called for traversable items. Methods loops every item and if it is traversable
it is recursively parsed, otherwise it is returned maybe transformed according to settings.

@param  array|Traversable $var
@return array
327698
private function walk($var)
    {
        $output = [];
        foreach ($var as $index => $item) {
            $output[$index] = is_array($item) || $item instanceof Traversable
                ? $this->collect($item)
                : $this->atomic($item);
        }

        return $output;
    }
984639
protected Object lookupWalkForVar(String var) {
		JsonNode current = node;
		while (current!=null) {
			Object result = lookupVar(current, var);
			if (result!=null) return result;
			
			if (current.hasAttribute("inheritProperties")) {
				current = current.getParent();				
			} else {
				current = null;
			}
		}
		return lookupVar(node, var);
	}
992082
function copyfrom($var) {
		if (is_string($var))
			$var=Base::instance()->get($var);
		foreach ($var as $key=>$val)
			$this->item[$key]=$val;
	}
1042006
public function varDump($var)
    {
        if (is_callable($this->varDumpCallback)) {
            return call_user_func($this->varDumpCallback, $var, $this);
        }

        $message = VarDumper::dumpAsString($var, $this->depth, $this->highlight);

        //don't encode highlighted variables
        if (!$this->highlight) {
            $message = Html::encode($message);
        }

        return $message;
    }
1124419
private function unique($var)
	{
		if (is_array($var))
		{
			// We only want to get unique items if they aren't associative
			if (isset($var[0]))
			{
				// Serialize vars, unique them, then unserialize
				$var = array_map('unserialize', array_unique(array_map('serialize', $var)));
			}

			foreach ($var as &$sub)
			{
				if (is_array($sub))
				{
					$sub = $this->unique($sub);
				}
			}
		}

		return $var;
	}
316242
static function traversableToArray($traversable, $depth = 0) {
		$vrat = array();
		if ($depth > 10) throw new \RuntimeException("Recursion is too deep.");
		if (!is_array($traversable) and !($traversable instanceof \Traversable)) {
			throw new \InvalidArgumentException("\$traversable must be an array or Traversable object.");
		}
		foreach ($traversable as $i=>$r) {
			if (is_array($r) or ($r instanceof \Traversable)) {
				$vrat[$i] = self::traversableToArray($r, $depth + 1);
			} else {
				$vrat[$i] = $r;
			}
		}
		return $vrat;
	}
719547
public function modularTwig($var = null)
    {
        if ($var !== null) {
            $this->modular_twig = (bool)$var;
            if ($var) {
                $this->visible(false);
                // some routable logic
                if (empty($this->header->routable)) {
                    $this->routable = false;
                }
            }
        }

        return $this->modular_twig;
    }
124076
function transpose(array &$var) {
		$out=[];
		foreach ($var as $keyx=>$cols)
			foreach ($cols as $keyy=>$valy)
				$out[$keyy][$keyx]=$valy;
		$var=$out;
	}
524103
public function dump_it($var) {
		$adapter = '\alkemann\hl\debug\util\adapters\\'. $this->options['mode'];
        if (is_array($var))
            return $adapter::dump_array($var, $this);
        elseif (is_object($var))
            return $adapter::dump_object($var, $this);
        else
            return $adapter::dump_other($var);
    }
423376
public static function getArray($var)
    {
        if (is_null($var) || empty($var)) {
            return [];
        }

        foreach ($var as $value) {
            if ((gettype($value) == 'object')
                && (get_class($value) == 'SimpleXMLElement')
            ) {
                return (array) $var;
            } elseif (!is_array($value)) {
                return [$var];
            }
        }

        return $var;
    }
640629
private function parseArray(array &$var, BasicObject $o)
    {
        $array = new BasicObject();
        $array->transplant($o);
        $array->size = \count($var);

        if (isset($var[$this->marker])) {
            --$array->size;
            $array->hints[] = 'recursion';

            $this->applyPlugins($var, $array, self::TRIGGER_RECURSION);

            return $array;
        }

        $rep = new Representation('Contents');
        $rep->implicit_label = true;
        $array->addRepresentation($rep);
        $array->value = $rep;

        if (!$array->size) {
            $this->applyPlugins($var, $array, self::TRIGGER_SUCCESS);

            return $array;
        }

        if ($this->depth_limit && $o->depth >= $this->depth_limit) {
            $array->hints[] = 'depth_limit';

            $this->applyPlugins($var, $array, self::TRIGGER_DEPTH_LIMIT);

            return $array;
        }

        $copy = \array_values($var);

        // It's really really hard to access numeric string keys in arrays,
        // and it's really really hard to access integer properties in
        // objects, so we just use array_values and index by counter to get
        // at it reliably for reference testing. This also affects access
        // paths since it's pretty much impossible to access these things
        // without complicated stuff you should never need to do.
        $i = 0;

        // Set the marker for recursion
        $var[$this->marker] = $array->depth;

        $refmarker = new stdClass();

        foreach ($var as $key => &$val) {
            if ($key === $this->marker) {
                continue;
            }

            $child = new BasicObject();
            $child->name = $key;
            $child->depth = $array->depth + 1;
            $child->access = BasicObject::ACCESS_NONE;
            $child->operator = BasicObject::OPERATOR_ARRAY;

            if (null !== $array->access_path) {
                if (\is_string($key) && (string) (int) $key === $key) {
                    $child->access_path = 'array_values('.$array->access_path.')['.$i.']'; // @codeCoverageIgnore
                } else {
                    $child->access_path = $array->access_path.'['.\var_export($key, true).']';
                }
            }

            $stash = $val;
            $copy[$i] = $refmarker;
            if ($val === $refmarker) {
                $child->reference = true;
                $val = $stash;
            }

            $rep->contents[] = $this->parse($val, $child);
            ++$i;
        }

        $this->applyPlugins($var, $array, self::TRIGGER_SUCCESS);
        unset($var[$this->marker]);

        return $array;
    }
748828
protected function varToString($var)
    {
        if (is_object($var)) {
            return get_class($var);
        }

        if (is_array($var)) {
            return 'Array';
        }

        if (is_resource($var)) {
            return sprintf('Resource(%s)', get_resource_type($var));
        }

        if (null === $var) {
            return 'null';
        }

        if (false === $var) {
            return 'false';
        }

        if (true === $var) {
            return 'true';
        }

        return (string) gettype($var);
    }
298500
protected function _arrayToString(array $var)
    {
        foreach ($var as $rowIndex => $row) {
            foreach ($row as $k => $v) {
                if (is_resource($var[$rowIndex][$k])) {
                    $var[$rowIndex][$k] = stream_get_contents($v);
                }
            }
        }

        $var = json_decode(str_replace(['(', ')'], ['&#40', '&#41'], json_encode($var)), true);
        $var = var_export($var, true);

        return str_replace(['array (', ')', '&#40', '&#41'], ['[', ']', '(', ')'], $var);
    }
38433
public static function returnStdObject(&$var)
    {
        // check if $var is already a standard object
        if (self::isInstanceOf($var, AbstractStdObject::class)) {
            return $var;
        }

        // try to map $var to a standard object
        if (self::isString($var)) {
            return new StringObject($var);
        } else {
            if (self::isArray($var)) {
                return new ArrayObject($var);
            }
        }

        // return value as StdObjectWrapper
        return new self($var);
    }
1197214
public function getIterator() : \Traversable
    {
        foreach ($this->objects as $hash => $object) {
            yield $object => $this->data[$hash];
        }
    }
374564
public function frontmatter($var = null)
    {
        $content = $this->content();

        if ($var !== null) {
            $content['frontmatter'] = (string) $var;
            $this->content($content);
        }

        return $content['frontmatter'];
    }
604275
public function load( $var )
    {
        $success = true;
        $val = apc_fetch( $this->_prefix . $var, $success );

        if( $success === false )
            return null;

        return $val;
    }