Adds `menu` section.

@param ArrayNodeDefinition $node
488954
private function addMenuSection(ArrayNodeDefinition $node)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $node
            ->children()
                ->arrayNode('menu')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->arrayNode('roots')
                            ->defaultValue(['main' => [
                                'title'       => 'Navigation principale',
                                'description' => 'Barre de navigation principale',
                            ]])
                            ->useAttributeAsKey('name')
                            ->prototype('array')
                                ->children()
                                    ->scalarNode('title')->isRequired()->cannotBeEmpty()->end()
                                    ->scalarNode('description')->end()
                                ->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();
    }
1269396
public function addNode(Node $node)
    {
        if (isset($this->idList[$node->id])) {
            /**
             * @todo -> fix this behavior so the get last is working again
             */
            $node->setId($this->getNextPossibleIdInContext($node));
        }

        // add to the keylist for iterations
        if (isset($this->keyList[$node->key])) {
            $this->keyList[$node->key]->push($node);
        } else {
            $this->keyList[$node->key] = new \SplDoublyLinkedList();
            $this->keyList[$node->key]->push($node);
        }

        $this->list[$node->key]  = $node;
        $this->idList[$node->id] = $node;

        return $this;
    }
1017676
public function add_node(node $node) {
        $name = $node->name;
        if (isset($this->nodes[$name])) {
            throw new \coding_exception("Node name $name already used");
        }
        $this->nodes[$node->name] = $node;
    }
49041
private function addRichTextSection(ArrayNodeDefinition $rootNode)
    {
        $ezRichTextNode = $rootNode->children()->arrayNode('ezrichtext')->children();
        $this->addCustomTagsSection($ezRichTextNode);
        $this->addCustomStylesSection($ezRichTextNode);
        $ezRichTextNode->end()->end()->end();
    }
1346869
private function addDocumentManagersSection(ArrayNodeDefinition $rootNode)
    {
        $rootNode
            ->fixXmlConfig('document_manager')
            ->children()
                ->arrayNode('document_managers')
                    ->useAttributeAsKey('id')
                    ->requiresAtLeastOneElement()
                    ->prototype('array')
                        ->treatNullLike([])
                        ->fixXmlConfig('filter')
                        ->children()
                            ->scalarNode('connection')->end()
                            ->scalarNode('database')->end()
                            ->booleanNode('logging')->defaultValue('%kernel.debug%')->end()
                            ->arrayNode('profiler')
                                ->addDefaultsIfNotSet()
                                ->treatTrueLike(['enabled' => true])
                                ->treatFalseLike(['enabled' => false])
                                ->children()
                                    ->booleanNode('enabled')->defaultValue('%kernel.debug%')->end()
                                    ->booleanNode('pretty')->defaultValue('%kernel.debug%')->end()
                                ->end()
                            ->end()
                            ->scalarNode('default_document_repository_class')->defaultValue(DocumentRepository::class)->end()
                            ->scalarNode('default_gridfs_repository_class')->defaultValue(DefaultGridFSRepository::class)->end()
                            ->scalarNode('repository_factory')->defaultValue('doctrine_mongodb.odm.container_repository_factory')->end()
                            ->scalarNode('persistent_collection_factory')->defaultNull()->end()
                            ->booleanNode('auto_mapping')->defaultFalse()->end()
                            ->arrayNode('filters')
                                ->useAttributeAsKey('name')
                                ->prototype('array')
                                    ->fixXmlConfig('parameter')
                                    ->beforeNormalization()
                                        ->ifString()
                                        ->then(static function ($v) {
                                            return ['class' => $v];
                                        })
                                    ->end()
                                    ->beforeNormalization()
                                        // The content of the XML node is returned as the "value" key so we need to rename it
                                        ->ifTrue(static function ($v) {
                                            return is_array($v) && isset($v['value']);
                                        })
                                        ->then(static function ($v) {
                                            $v['class'] = $v['value'];
                                            unset($v['value']);

                                            return $v;
                                        })
                                    ->end()
                                    ->children()
                                        ->scalarNode('class')->isRequired()->end()
                                        ->booleanNode('enabled')->defaultFalse()->end()
                                        ->arrayNode('parameters')
                                            ->treatNullLike([])
                                            ->useAttributeAsKey('name')
                                            ->prototype('variable')
                                                ->beforeNormalization()
                                                    // Detect JSON object and array syntax (for XML)
                                                    ->ifTrue(static function ($v) {
                                                        return is_string($v) && (preg_match('/\[.*\]/', $v) || preg_match('/\{.*\}/', $v));
                                                    })
                                                    // Decode objects to associative arrays for consistency with YAML
                                                    ->then(static function ($v) {
                                                        return json_decode($v, true);
                                                    })
                                                ->end()
                                            ->end()
                                        ->end()
                                    ->end()
                                ->end()
                            ->end()
                            ->arrayNode('metadata_cache_driver')
                                ->addDefaultsIfNotSet()
                                ->beforeNormalization()
                                    ->ifString()
                                    ->then(static function ($v) {
                                        return ['type' => $v];
                                    })
                                ->end()
                                ->children()
                                    ->scalarNode('type')->defaultValue('array')->end()
                                    ->scalarNode('class')->end()
                                    ->scalarNode('host')->end()
                                    ->integerNode('port')->end()
                                    ->scalarNode('instance_class')->end()
                                    ->scalarNode('id')->end()
                                    ->scalarNode('namespace')->end()
                                ->end()
                            ->end()
                        ->end()
                        ->fixXmlConfig('mapping')
                        ->children()
                            ->arrayNode('mappings')
                                ->useAttributeAsKey('name')
                                ->prototype('array')
                                    ->beforeNormalization()
                                        ->ifString()
                                        ->then(static function ($v) {
                                            return ['type' => $v];
                                        })
                                    ->end()
                                    ->treatNullLike([])
                                    ->treatFalseLike(['mapping' => false])
                                    ->performNoDeepMerging()
                                    ->children()
                                        ->scalarNode('mapping')->defaultValue(true)->end()
                                        ->scalarNode('type')->end()
                                        ->scalarNode('dir')->end()
                                        ->scalarNode('prefix')->end()
                                        ->scalarNode('alias')->end()
                                        ->booleanNode('is_bundle')->end()
                                    ->end()
                                ->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();
    }
1209240
protected function setupTree(ArrayNodeDefinition $rootNode)
    {
        $rootNode
            ->children()
                ->arrayNode('repositories')
                    ->prototype('array')
                        ->children()
                            ->scalarNode('secret')
                                ->isRequired()
                            ->end()
                            ->scalarNode('endpoint')
                                ->isRequired()
                            ->end()
                            ->booleanNode('test')
                                ->defaultFalse();
    }
854154
private function addObjectsSection(ArrayNodeDefinition $node)
    {
        $node
            ->children()
                ->arrayNode('objects')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->arrayNode('contact')
                            ->addDefaultsIfNotSet()
                            ->children()
                                ->scalarNode('model')->defaultValue(Contact::class)->end()
                                ->scalarNode('repository')->defaultValue(ContactRepository::class)->end()
                            ->end()
                        ->end()
                        ->arrayNode('account')
                            ->addDefaultsIfNotSet()
                            ->children()
                                ->scalarNode('model')->defaultValue(Account::class)->end()
                                ->scalarNode('repository')->defaultValue(AccountRepository::class)->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();
    }
405287
private function addSelect2(ArrayNodeDefinition $rootNode)
    {
        $rootNode
            ->children()
                ->arrayNode('select2')
                    ->canBeUnset()
                    ->treatNullLike(['enabled' => true])
                    ->treatTrueLike(['enabled' => true])
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('enabled')->defaultTrue()->end()
                    ->end()
                ->end()
                ->arrayNode('datetime_picker')
                    ->canBeUnset()
                    ->treatNullLike(['enabled' => true])
                    ->treatTrueLike(['enabled' => true])
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('enabled')->defaultTrue()->end()
                    ->end()
                ->end()
            ->end()
        ;
    }
218788
private function addServiceSection(ArrayNodeDefinition $node)
    {
        $node
            ->children()
                ->arrayNode('service')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->scalarNode('class')
                            ->defaultValue(Service\Queue::class)->cannotBeEmpty()
                        ->end()
                        ->scalarNode('alias')
                            ->defaultValue('queue')->cannotBeEmpty()
                        ->end()
                        ->scalarNode('storage')
                            ->defaultValue('redis')->cannotBeEmpty()
                        ->end()
                    ->end()
                ->end()
            ->end();
    }
191449
public function appendXml(DOMNode $node)
    {
        $doc = ($node instanceof DOMDocument) ? $node : $node->ownerDocument;

        $tableNode = $node->appendChild($doc->createElement('table'));
        $tableNode->setAttribute('name', $this->getCommonName());

        if ($this->getSchema() !== null) {
            $tableNode->setAttribute('schema', $this->getSchema());
        }

        if ($this->phpName !== null) {
            $tableNode->setAttribute('phpName', $this->phpName);
        }

        if ($this->idMethod !== null) {
            $tableNode->setAttribute('idMethod', $this->idMethod);
        }

        if ($this->skipSql !== null) {
            $tableNode->setAttribute('skipSql', var_export($this->skipSql, true));
        }

        if ($this->readOnly !== null) {
            $tableNode->setAttribute('readOnly', var_export($this->readOnly, true));
        }

        if ($this->treeMode !== null) {
            $tableNode->setAttribute('treeMode', $this->treeMode);
        }

        if ($this->reloadOnInsert !== null) {
            $tableNode->setAttribute('reloadOnInsert', var_export($this->reloadOnInsert, true));
        }

        if ($this->reloadOnUpdate !== null) {
            $tableNode->setAttribute('reloadOnUpdate', var_export($this->reloadOnUpdate, true));
        }

        if ($this->forReferenceOnly !== null) {
            $tableNode->setAttribute('forReferenceOnly', var_export($this->forReferenceOnly, true));
        }

        if ($this->abstractValue !== null) {
            $tableNode->setAttribute('abstract', var_export($this->abstractValue, true));
        }

        if ($this->interface !== null) {
            $tableNode->setAttribute('interface', $this->interface);
        }

        if ($this->description !== null) {
            $tableNode->setAttribute('description', $this->description);
        }

        if ($this->namespace !== null) {
            $tableNode->setAttribute('namespace', $this->namespace);
        }

        if ($this->pkg !== null && !$this->pkgOverridden) {
            $tableNode->setAttribute('package', $this->pkg);
        }

        if ($this->baseClass !== null) {
            $tableNode->setAttribute('baseClass', $this->baseClass);
        }

        if ($this->basePeer !== null) {
            $tableNode->setAttribute('basePeer', $this->basePeer);
        }

        if ($this->getIsCrossRef()) {
            $tableNode->setAttribute('isCrossRef', $this->getIsCrossRef());
        }

        foreach ($this->columnList as $col) {
            $col->appendXml($tableNode);
        }

        foreach ($this->validatorList as $validator) {
            $validator->appendXml($tableNode);
        }

        foreach ($this->foreignKeys as $fk) {
            $fk->appendXml($tableNode);
        }

        foreach ($this->idMethodParameters as $param) {
            $param->appendXml($tableNode);
        }

        foreach ($this->indices as $index) {
            $index->appendXml($tableNode);
        }

        foreach ($this->unices as $unique) {
            $unique->appendXml($tableNode);
        }

        foreach ($this->vendorInfos as $vi) {
            $vi->appendXml($tableNode);
        }
    }
952052
public function removeNode(Node $node)
    {
        $node->setNavigation(null);
        $this->nodes->removeElement($node);
    }
931582
public void addNode(Node n) {
		try {
			structure.addNode(n);
			for (NodeListener listener : nodeListeners)
				listener.onInsert(n);
		} catch (DuplicatedNodeException e) {
			duplicatedNodesCounter++;
		}
	}
4579
public function addNodeToMenu(Menu $menu, MenuItem $node, $startDepth)
    {
        if ($node->getLvl() < $startDepth) {
            return false;
        }

        if ($node->getLvl() > $startDepth) {
            $menu = $this->getParentMenu($menu, $node);
        }

        if (is_object($menu)) {
            $knpMenuNode = $this->createFromMenuItem($node);
            if (!is_null($knpMenuNode)) {
                $menu->addChild($knpMenuNode);
                $knpMenuNode->setAttribute('class', $node->getLinkClass());
                $knpMenuNode->setExtra('translation_domain', false);
                if ($node->getVisibility() != MenuItem::VISIBILITY_PUBLIC && !$this->isLoggedIn) {
                    $knpMenuNode->setDisplay(false);
                }

                return $knpMenuNode;
            }
        }

        return false;
    }
469756
private function addImagePlaceholderSection(ArrayNodeDefinition $rootNode)
    {
        $rootNode
            ->children()
                ->arrayNode('image_placeholder')
                    ->info('Configuration for strategy of replacing missing images')
                    ->useAttributeAsKey('name')
                    ->arrayPrototype()
                        ->children()
                            ->scalarNode('provider')
                            ->end()
                            ->variableNode('options')
                                ->defaultValue([])
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();
    }
521454
private function addCurrencySection(ArrayNodeDefinition $node)
    {
        // @codingStandardsIgnoreStart
        $node
            ->children()
                ->arrayNode('currencies')
                    ->prototype('scalar')
                    ->end()
                ->end()
                ->scalarNode('reference_currency')
                    ->isRequired()
                    ->cannotBeEmpty()
                ->end()
                ->booleanNode('enable_pair_history')
                    ->defaultValue(false)
                ->end()
                ->integerNode('decimals')
                    ->defaultValue(2)
                    ->min(0)
                ->end()
                ->scalarNode('storage')
                    ->cannotBeEmpty()
                    ->defaultValue('csv')
                    ->validate()
                    ->ifNotInArray(array('csv', 'doctrine'))
                        ->thenInvalid('Invalid storage "%s"')
                    ->end()
                ->end()
                ->scalarNode('ratio_provider')
                    ->cannotBeEmpty()
                    ->defaultValue('tbbc_money.ratio_provider.ecb')
                ->end()
                ->arrayNode('templating')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->arrayNode('engines')
                            ->isRequired()
                            ->requiresAtLeastOneElement()
                            ->example(array('twig'))
                            ->beforeNormalization()
                                ->ifTrue(function($v){ return !is_array($v); })
                                ->then(function($v){ return array($v); })
                            ->end()
                            ->prototype('scalar')
                                ->validate()
                                    ->ifNotInArray(array('twig', 'php'))
                                    ->thenInvalid('Only "twig" and "php" engines are supported.')
                                ->end()
                            ->end()
                            ->defaultValue(array('twig'))
                        ->end()
                    ->end()
                ->end()
            ->end()
        ;
        // @codingStandardsIgnoreEnd
    }
603965
public function addChildAsLast(Node $node)
    {
        if(null === $this->children)
        {
            $this->children = array();
        }

        $this->children[] = $node;
    }
62720
protected function addPathIfNeeded(EloquentNode $node)
    {
        // No path column
        if (!$this->pathKey) {
            return;
        }

        // Path was passed
        if ($node->getAttribute($this->pathKey)) {
            return;
        }

        $segment = $node->getAttribute($this->segmentKey);

        if ($node->isRoot() && $segment) {
            $node->setAttribute($this->pathKey, '/' . $this->cleanSegment($segment));
            return;
        }

        $parent = $this->guessParent($node);

        $parentPath = $parent->getPath();

        $node->setAttribute($this->pathKey, rtrim($parentPath, '/') . '/' . $this->cleanSegment($node->getPathSegment()));

    }