private function addGlobalsSection(NodeBuilder $rootNode) { $rootNode->fixXmlConfig('global')->arrayNode('globals')->useAttributeAsKey('key')->prototype('array')->beforeNormalization()->ifTrue(function ($v) { return is_string($v) && '@' === substr($v, 0, 1); })->then(function ($v) { return array('id' => substr($v, 1), 'type' => 'service'); })->end()->beforeNormalization()->ifTrue(function ($v) { if (is_array($v)) { $keys = array_keys($v); sort($keys); return $keys !== array('id', 'type') && $keys !== array('value'); } return true; })->then(function ($v) { return array('value' => $v); })->end()->scalarNode('id')->end()->scalarNode('type')->validate()->ifNotInArray(array('service'))->thenInvalid('The %s type is not supported')->end()->end()->variableNode('value')->end()->end()->end(); }