Add a children node.

@param AbstractNode $node The children node.
@return AbstractNode Returns this node.
162065
public function addNode(AbstractNode $node) {
        $node->parent           = $this;
        $this->index[$node->id] = count($this->nodes);
        $this->nodes[]          = $node;
        return $this;
    }
1042148
public function apply(AbstractNode $node)
    {
        if (!$this->isFacade($node)) {
            return;
        }

        $this->applyStatelessThereAreNoProperties($node);

        foreach ($node->getMethods() as $method) {
            $this->applyNoInstantiationsWithNew($method);
        }
    }
1002011
protected function calculateNode(AbstractNode $node)
    {
        if (is_a($node, SymbolNode::class)) {
            /** @var SymbolNode $node */

            return $this->calculateSymbolNode($node);
        } elseif (is_a($node, FunctionNode::class)) {
            /** @var FunctionNode $node */

            return $this->calculateFunctionNode($node);
        } elseif (is_a($node, ContainerNode::class)) {
            /** @var ContainerNode $node */

            return $this->calculateContainerNode($node);
        } else {
            throw new \InvalidArgumentException('Error: Cannot calculate node of unknown type "'.get_class($node).'"');
        }
    }
83195
public function childrenHierarchyWithNodes($node = null, $direct = false, array $options = [], $includeNode = false)
    {
        $tree = $this->childrenHierarchy($node, $direct, $options, $includeNode);

        return $this->fillTreeNodes($tree);
    }
532376
public function addNodes(array $nodes): self
    {
        foreach ($nodes as $node) {
            $this->addNode($node);
        }

        return $this;
    }
831004
public function createChildNodes(NodeInterface $node)
    {
        $nodeType = $node->getNodeType();
        foreach ($nodeType->getAutoCreatedChildNodes() as $childNodeName => $childNodeType) {
            try {
                $node->createNode($childNodeName, $childNodeType);
            } catch (NodeExistsException $exception) {
                // If you have a node that has been marked as removed, but is needed again
                // the old node is recovered
                $childNodePath = NodePaths::addNodePathSegment($node->getPath(), $childNodeName);
                $contextProperties = $node->getContext()->getProperties();
                $contextProperties['removedContentShown'] = true;
                $context = $this->contextFactory->create($contextProperties);
                $childNode = $context->getNode($childNodePath);
                if ($childNode->isRemoved()) {
                    $childNode->setRemoved(false);
                }
            }
        }
    }
519276
public function append(Node $node)
    {

        if (!is_array($this->_children)) {
            $this->_children = [];
        }

        $this->_children[] = $node;
        return $this;
    }
1268553
public function addNode(Node $node)
    {
        $node->setNavigation($this);
        $this->nodes[] = $node;

        return $this;
    }
1169887
public function getFirstChild(AbstractNestedNode $node)
    {
        $children = $this->getDescendants($node, 1);
        if (0 < count($children)) {
            return $children[0];
        }

        return;
    }
659372
public function addChild(Node $node)
    {
        if($node instanceof NodeWrapper)
        {
            if($node == $this)
            {
                throw new \InvalidArgumentException('Cannot insert node as a child of itself');
            }

            $node->insertAsLastChildOf($this);
            return $node;
        }

        $node->setLeftValue($this->getRightValue());
        $node->setRightValue($this->getRightValue() + 1);
        if($this->hasManyRoots())
        {
            $node->setRootValue($this->getRootValue());
        }

        $em = $this->getManager()->getEntityManager();

        // beginTransaction
        $em->getConnection()->beginTransaction();
        try
        {
            $this->shiftRLRange($this->getRightValue(), 0, 2, ($this->hasManyRoots() ? $this->getRootValue() : null));

            $em->persist($node);

            $em->flush();
            $em->getConnection()->commit();
        }
        catch (\Exception $e)
        {
            // @codeCoverageIgnoreStart
            $em->close();
            $em->getConnection()->rollback();
            throw $e;
            // @codeCoverageIgnoreEnd
        }
        // endTransaction

        return $this->getManager()->wrapNode($node);
    }
1077566
private function addNode(NodeInterface $node)
    {
        $this->nodeIndex++;
        $this->graph['nodes'][] = $node->toArray();

        return $this->nodeIndex;
    }
858118
public function addChild(MenuNode $child)
    {
        $child->parent = $this;
        $this->children[] = $child;

        return $this;
    }
255460
public function apply(AbstractNode $node)
    {
        if (preg_match('([A-Za-z0-9]+Bridge$)', $node->getName()) === 0) {
            return;
        }

        $this->verifyClass($node);
        $this->verifyInterface($node);
    }
529060
public function addChild(PolicyNode $node): self
    {
        $id = spl_object_hash($node);
        $node->_parent = $this;
        $this->_children[$id] = $node;
        return $this;
    }
833540
public function addNode(NodeInterface $node)
    {
        if ($this->checkChildNode($node)) {
            $this->nodes->add($node);

            $node->setPosition(count($this->getNodes()));
            $node->setParent($this);
        }

        return $this;
    }
1129643
public function apply(AbstractNode $node): void
    {
        if (!$this->isPlugin($node)) {
            return;
        }

        $className = $node->getName();
        $suffix = substr($className, -strlen(static::EXPECTED_INTERFACE_NAME_SUFFIX));
        if ($suffix !== static::EXPECTED_INTERFACE_NAME_SUFFIX) {
            $this->addViolation($node, [$node->getName()]);
        }
    }
291640
protected function detachFromTree(AbstractNestedNode $node)
    {
        if (true === $node->isRoot()) {
            return $this;
        }

        $this->refreshExistingNode($node)
                ->createQueryBuilder('n')
                ->set('n._leftnode', 'n._leftnode - :delta_node')
                ->set('n._rightnode', 'n._rightnode - :delta_node')
                ->set('n._level', 'n._level - :delta_level')
                ->set('n._root', ':node')
                ->andIsDescendantOf($node)
                ->setParameter('delta_node', $node->getLeftnode() - 1)
                ->setParameter('delta_level', $node->getLevel())
                ->setParameter('node', $node)
                ->update()
                ->getQuery()
                ->execute();

        $this->shiftRlValues($node, $node->getLeftnode(), - $node->getWeight());

        $node->setRightnode($node->getWeight())
                ->setLeftnode(1)
                ->setLevel(0)
                ->setRoot($node);

        return $this;
    }