Recursive function to convert an array of condition data to a nodes tree.

@return NodeInterface|null
350183
protected function getNodeRecursive()
    {
        while (false === empty($this->scope->getExpression())) {
            $currentExpression = $this->scope->getExpression();
            $this->processToken($currentExpression[0]);
            $this->processLogicalAndNode();
        }

        $this->processLastLogicalOperatorNode();

        $node = $this->scope->getNode();
        unset($this->scope);

        return $node;
    }
452009
public function buildTree()
    {
        if (null === $this->root) {
            throw new \RuntimeException('The configuration tree has no root node.');
        }
        if (null !== $this->tree) {
            return $this->tree;
        }

        return $this->tree = $this->root->getNode(true);
    }
1140056
public function nodes()
    {
        $request = $this->createRequestInstance(self::CAT_NODES, null, null);

        return $this->client->send($request);
    }
1310329
public function prev()
    {

        $index = $this->parent->indexOf($this) - 1;

        return isset($this->parent->children[$index]) ? $this->parent->children[$index] : null;
    }
1112871
public function getNodeByValue($value): ?Node {
        if (!$this->containsValue($value)) {
            return null;
        }
        $tmp = $this->getHead();
        while ($tmp !== null) {
            $val = $tmp->getValue();
            if (Comparator::equals($val, $value)) {
                //if the value is found then return it
                return $tmp;
            }
            $tmp = $tmp->getNext();
        }
        return null;
    }
115407
protected function getNodeBuilder()
    {
        if (null === $this->nodeBuilder) {
            $this->nodeBuilder = new NodeBuilder();
        }

        return $this->nodeBuilder->setParent($this);
    }
1224342
public function childNodes($idx = -1)
    {
        $nodeList = $this->getIterator();

        if ($idx === -1) {
            return $nodeList;
        }

        if (isset($nodeList[$idx])) {
            return $nodeList[$idx];
        }

        return null;
    }
911673
public function getRoot() : Node {
        $node = $this;
        while ($node->parent !== null) {
            $node = $node->parent;
        }
        return $node;
    }
1357894
public function getLevel()
    {
        if ($this->_level !== null) {
            return $this->_level;
        }

        if ($this->isRoot()) {
            $this->_level = -1;
            return $this->_level;
        }

        $parents = array($this);
        $node = $this;

        while ($parent = $node->getParent()){
            if (!$parent->isRoot()) {
                $parents[] = $parent;
            }
            $node = $parent;
        }

        $this->_level = count($parents);

        return $this->_level;
    }
137922
private function split()
	{
		$right = new BTree();

		for ($i=0; $i<self::T-1; $i++)
		{
			$right->_keys[$i]      = $this->_keys[self::T+$i];
			$right->_children[$i]  = $this->_children[self::T+$i];
			$this->_children[self::T+$i];
		}

		$right->_children[self::T-1]  = $this->_children[2*self::T-1];
		$this->_children[2*self::T-1] = null;
		$this->_n	       = (self::T-1);
		$right->_n	      = (self::T-1);

		return $right;

	}
1030655
public function findReferencedNodes(): TraversableNodes
    {
        $referencedNodes = [];
        foreach ($this->getNodeType()->getProperties() as $propertyName => $property) {
            $propertyType = $this->getNodeType()->getPropertyType($propertyName);
            if ($propertyType === 'reference' && $this->getProperty($propertyName) instanceof TraversableNodeInterface) {
                $referencedNodes[] = $this->getProperty($propertyName);
            } elseif ($propertyName === 'references' && !empty($this->getProperty($propertyName))) {
                foreach ($this->getProperty($propertyName) as $node) {
                    if ($node instanceof TraversableNodeInterface) {
                        $referencedNodes[] = $node;
                    }
                }
            }
        }

        return TraversableNodes::fromArray($referencedNodes);
    }
1343027
public function getStreet()
    {
        $nodes = $this->response->get('contact:addr/contact:street', $this->node);

        if ($nodes->length === 0) {
            return null;
        }

        foreach ($nodes as $node) {
            yield $node->nodeValue;
        }
    }
749910
public function get_tree()
    {
        $datalen = strlen($this->raw_data);
        $result  = array();
        $start   = 0;

        while (($pos = @strpos($this->raw_data, self::SEPARATOR_ELEMENT, $start))
            || ($start < $datalen && ($pos = $datalen))
        ) {
            $len   = $pos - $start;
            $elem  = substr($this->raw_data, $start, $len);
            $items = explode(self::SEPARATOR_ITEM, $elem);
            $result[array_shift($items)] = $this->build_thread($items);
            $start = $pos + 1;
        }

        return $result;
    }
979957
public function findRootNodes()
    {
        $possibleRoots = new SplObjectStorage();
        foreach ($this->nodes as $node) {
            $possibleRoots[$node] = true;
        }

        // Detect all nodes which couldn't be root
        foreach ($this->dependencies as $node) {
            $nodeDependencies = $this->dependencies[$node];
            foreach ($nodeDependencies as $dependency) {
                $possibleRoots[$dependency] = false;
            }
        }

        // Create array which contains all roots
        $rootNodes = array();
        foreach ($possibleRoots as $node) {
            if ($possibleRoots[$node]) {
                $rootNodes[] = $node;
            }
        }

        return $rootNodes;
    }
819086
public function getFirstChild()
    {
        if($this->isLeaf())
        {
            return null;
        }

        if($this->children !== null)
        {
            $ary = array_slice($this->children, 0, 1);
            return $ary[0];
        }

        $qb = $this->getManager()->getConfiguration()->getBaseQueryBuilder();
        $alias = $this->getManager()->getConfiguration()->getQueryBuilderAlias();

        $qb->andWhere("$alias.".$this->getLeftFieldName()." = :lft1")
            ->setParameter('lft1', $this->getLeftValue() + 1);
        if($this->hasManyRoots())
        {
            $qb->andWhere("$alias.".$this->getRootFieldName()." = :root")
                ->setParameter('root', $this->getRootValue());
        }

        $q = $qb->getQuery();
		if ($this->getManager()->getConfiguration()->isQueryHintSet()){
			$q = $this->getManager()->addHintToQuery($q);
		}
		$results = $q->getResult();

        return $this->getManager()->wrapNode($results[0]);
    }
985020
public function getChildrenRecursive()
    {
        $res = new ObjectCollection();
        foreach ($this->children() as $child) {
            $res->add($child);
            if ($child instanceof ParentNodeInterface) {
                $res->addMany($child->getChildrenRecursive());
            }
        }

        return $res;
    }
1270056
public function getTree() {
    $children = array();
    $properties = $this->getChildProperties();
    $child = $this->head;
    $i = 0;
    while ($child) {
      $key = array_search($child, $properties, TRUE);
      if (!$key) {
        $key = $i;
      }
      if ($child instanceof ParentNode) {
        $children[$key] = $child->getTree();
      }
      else {
        /** @var TokenNode $child */
        $children[$key] = array($child->getTypeName() => $child->getText());
      }
      $child = $child->next;
      $i++;
    }
    $class_name = get_class($this);
    return array($class_name => $children);
  }