本文整理汇总了PHP中Symfony\Component\Config\Definition\Builder\TreeBuilder::buildTree方法的典型用法代码示例。如果您正苦于以下问题:PHP TreeBuilder::buildTree方法的具体用法?PHP TreeBuilder::buildTree怎么用?PHP TreeBuilder::buildTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Config\Definition\Builder\TreeBuilder
的用法示例。
在下文中一共展示了TreeBuilder::buildTree方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConfigTree
/**
* Generates the configuration tree.
*
* @return \Symfony\Component\DependencyInjection\Configuration\NodeInterface
*/
public function getConfigTree()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('pss_doctrine_extensions');
$rootNode->children()->arrayNode('blameable')->children()->scalarNode('user_class')->end()->booleanNode('store_object')->defaultValue(false)->end()->arrayNode('drivers')->addDefaultsIfNotSet()->children()->booleanNode('orm')->defaultValue(true)->end()->booleanNode('mongodb')->defaultValue(false)->end()->end()->end()->end()->end()->end();
return $treeBuilder->buildTree();
}
示例2: buildConfigTree
/**
* @return \Symfony\Component\Config\Definition\NodeInterface
*/
protected function buildConfigTree()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('allSettings');
$rootNode->children()->arrayNode('jimFlowKlopfer')->children()->booleanNode('run')->defaultTrue()->end()->scalarNode('command')->isRequired()->end()->scalarNode('photoDirectory')->isRequired()->end()->scalarNode('jsonDirectory')->isRequired()->end()->end()->end()->arrayNode('board')->children()->scalarNode('provider_name')->end()->scalarNode('domain')->isRequired()->end()->scalarNode('apiToken')->isRequired()->end()->scalarNode('boardId')->isRequired()->end()->arrayNode('commands')->children()->scalarNode('move')->isRequired()->end()->end()->end()->scalarNode('ticketRegex')->isRequired()->end()->arrayNode('columns')->prototype('scalar')->end()->end()->end()->end()->end();
return $treeBuilder->buildTree();
}
示例3: getConfigTree
/**
* Generates the configuration tree.
*
* @return Symfony\Component\Config\Definition\NodeInterface
*/
public function getConfigTree()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sensio_framework_extra', 'array');
$rootNode->children()->arrayNode('router')->children()->booleanNode('annotations')->defaultValue(true)->end()->end()->end()->arrayNode('request')->children()->booleanNode('converters')->defaultValue(true)->end()->end()->end()->arrayNode('view')->children()->booleanNode('annotations')->defaultValue(true)->end()->booleanNode('manager_null_arguments')->defaultValue(true)->end()->end()->end()->arrayNode('cache')->children()->booleanNode('annotations')->defaultValue(true)->end()->end()->end()->end();
return $treeBuilder->buildTree();
}
示例4: getConfigTree
/**
* Generates the configuration tree.
*
* @return Symfony\Component\Config\Definition\NodeInterface
*/
public function getConfigTree()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sensio_framework_extra', 'array');
$rootNode->children()->arrayNode('router')->addDefaultsIfNotSet()->children()->booleanNode('annotations')->defaultTrue()->end()->end()->end()->arrayNode('request')->addDefaultsIfNotSet()->children()->booleanNode('converters')->defaultTrue()->end()->end()->end()->arrayNode('view')->addDefaultsIfNotSet()->children()->booleanNode('annotations')->defaultTrue()->end()->end()->end()->arrayNode('cache')->addDefaultsIfNotSet()->children()->booleanNode('annotations')->defaultTrue()->end()->end()->end()->end();
return $treeBuilder->buildTree();
}
示例5: provideTypesAndConfig
public function provideTypesAndConfig()
{
$tests = array();
$extension = new KnpUOAuth2ClientExtension();
foreach (KnpUOAuth2ClientExtension::getAllSupportedTypes() as $type) {
$configurator = $extension->getConfigurator($type);
$tree = new TreeBuilder();
$configNode = $tree->root('testing');
$configurator->buildConfiguration($configNode->children(), $type);
/** @var ArrayNode $arrayNode */
$arrayNode = $tree->buildTree();
$config = array('client_id' => 'CLIENT_ID_TEST', 'client_secret' => 'CLIENT_SECRET_TEST', 'redirect_route' => 'go_there', 'redirect_params' => array(), 'use_state' => rand(0, 1) == 0);
// loop through and assign some random values
foreach ($arrayNode->getChildren() as $child) {
/** @var NodeInterface $child */
if ($child instanceof ArrayNode) {
$config[$child->getName()] = array();
} else {
$config[$child->getName()] = rand();
}
}
$tests[] = array($type, $config);
}
return $tests;
}
示例6: buildConfigTree
/**
* @return \Symfony\Component\Config\Definition\NodeInterface
*/
protected function buildConfigTree()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('allSettings');
$rootNode->children()->scalarNode('domain')->isRequired()->end()->scalarNode('apiToken')->isRequired()->end()->scalarNode('boardId')->isRequired()->end()->end();
return $treeBuilder->buildTree();
}
示例7: getConfigTree
/**
* {@inheritDoc}
*/
public function getConfigTree()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('nodrew_dfp', 'array');
$rootNode->children()->scalarNode('publisher_id')->isRequired()->cannotBeEmpty()->end()->scalarNode('div_class')->defaultValue('dfp-ad-unit')->end()->variableNode('targets')->end()->end();
return $treeBuilder->buildTree();
}
示例8: getConfigTree
/**
* Generates the configuration tree.
*
* @return \Symfony\Component\Config\Definition\NodeInterface
*/
public function getConfigTree()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('zend', 'array');
$rootNode->arrayNode('logger')->canBeUnset()->scalarNode('priority')->defaultValue('INFO')->end()->scalarNode('path')->defaultValue('%kernel.logs_dir%/%kernel.environment%.log')->end()->booleanNode('log_errors')->defaultFalse()->end()->end();
return $treeBuilder->buildTree();
}
示例9: getConfigTree
/**
* Generates the configuration tree.
*
* @return \Symfony\Component\DependencyInjection\Configuration\NodeInterface
*/
public function getConfigTree()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('gravatar', 'array');
$rootNode->children()->scalarNode('size')->defaultValue('80')->end()->scalarNode('rating')->defaultValue('g')->end()->scalarNode('default')->defaultValue('mm')->end()->end();
return $treeBuilder->buildTree();
}
示例10: getConfigTreeBuilder
/**
* Generates the configuration tree.
*
* @return \Symfony\Component\Config\Definition\NodeInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('opcvm360');
$rootNode->children()->scalarNode('login')->isRequired()->end()->scalarNode('password')->isRequired()->end()->scalarNode('base_url')->end()->end();
return $treeBuilder->buildTree();
}
示例11: getJobTemplatesConfigTree
/**
* @return NodeInterface
*/
protected function getJobTemplatesConfigTree()
{
$treeBuilder = new TreeBuilder();
$root = $treeBuilder->root('job_templates');
$root->useAttributeAsKey('name')->prototype('array')->children()->arrayNode('templates')->children()->scalarNode('show')->end()->scalarNode('edit')->end()->end()->end()->end()->end();
return $treeBuilder->buildTree();
}
示例12: getConfigTree
/**
* Generates the configuration tree.
*
* @param Boolean $kernelDebug
*
* @return \Symfony\Component\Config\Definition\ArrayNode The config tree
*/
public function getConfigTree($kernelDebug)
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('swiftmailer');
$rootNode->children()->scalarNode('transport')->defaultValue('smtp')->validate()->ifNotInArray(array('smtp', 'mail', 'sendmail', 'gmail', null))->thenInvalid('The %s transport is not supported')->end()->end()->scalarNode('username')->defaultNull()->end()->scalarNode('password')->defaultNull()->end()->scalarNode('host')->defaultValue('localhost')->end()->scalarNode('port')->defaultValue(false)->end()->scalarNode('encryption')->defaultNull()->validate()->ifNotInArray(array('tls', 'ssl', null))->thenInvalid('The %s encryption is not supported')->end()->end()->scalarNode('auth_mode')->defaultNull()->validate()->ifNotInArray(array('plain', 'login', 'cram-md5', null))->thenInvalid('The %s authentication mode is not supported')->end()->end()->arrayNode('spool')->children()->scalarNode('type')->defaultValue('file')->end()->scalarNode('path')->defaultValue('%kernel.cache_dir%/swiftmailer/spool')->end()->end()->end()->scalarNode('delivery_address')->end()->booleanNode('disable_delivery')->end()->booleanNode('logging')->defaultValue($kernelDebug)->end()->end();
return $treeBuilder->buildTree();
}
示例13: getConfigTree
/**
* Generates the configuration tree.
*
* @return \Symfony\Component\DependencyInjection\Configuration\NodeInterface
*/
public function getConfigTree()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('stfalcon_tinymce', 'array');
$rootNode->children()->scalarNode('mode')->defaultValue('textareas')->validate()->ifNotInArray(array('textareas', 'specific_textareas', 'exact', 'none'))->thenInvalid('TynymceBundle: the %s mode is not supported')->end()->end()->scalarNode('theme')->defaultValue('advanced')->validate()->ifNotInArray(array('advanced', 'simple'))->thenInvalid('TynymceBundle: the %s theme is not supported')->end()->end()->scalarNode('theme_advanced_buttons1')->defaultValue("mylistbox,mysplitbutton,bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo,link,unlink")->end()->scalarNode('theme_advanced_buttons2')->defaultValue("")->end()->scalarNode('theme_advanced_buttons3')->defaultValue("")->end()->scalarNode('plugins')->defaultValue("")->end()->booleanNode('include_jquery')->defaultValue("true")->end()->scalarNode('upload_directory')->default("")->end()->scalarNode('web_path')->default("images")->end()->end();
return $treeBuilder->buildTree();
}
示例14: getMainConfigTree
public function getMainConfigTree(array $factories)
{
$tb = new TreeBuilder();
$rootNode = $tb->root('security');
$rootNode
->children()
->scalarNode('access_denied_url')->defaultNull()->end()
->scalarNode('session_fixation_strategy')->cannotBeEmpty()->defaultValue('migrate')->end()
->end()
// add a faux-entry for factories, so that no validation error is thrown
->fixXmlConfig('factory', 'factories')
->children()
->arrayNode('factories')->ignoreExtraKeys()->end()
->end()
;
$this->addAclSection($rootNode);
$this->addEncodersSection($rootNode);
$this->addProvidersSection($rootNode);
$this->addFirewallsSection($rootNode, $factories);
$this->addAccessControlSection($rootNode);
$this->addRoleHierarchySection($rootNode);
return $tb->buildTree();
}
示例15: load
public function load(array $configs, ContainerBuilder $container)
{
$processor = new Processor();
$configuration = new Configuration();
$config = $processor->processConfiguration($configuration, $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.xml');
$providers = $config['providers'];
foreach ($providers as $key => $providerConfig) {
// manually make sure "type" is there
if (!isset($providerConfig['type'])) {
throw new InvalidConfigurationException(sprintf('Your "knpu_oauth2_client.providers." config entry is missing the "type" key.', $key));
}
$type = $providerConfig['type'];
unset($providerConfig['type']);
if (!isset(self::$supportedProviderTypes[$type])) {
throw new InvalidConfigurationException(sprintf('The "knpu_oauth2_client.providers" config "type" key "%s" is not supported. We support (%s)', $type, implode(', ', self::$supportedProviderTypes)));
}
// process the configuration
$tree = new TreeBuilder();
$node = $tree->root('knpu_oauth2_client/providers/' . $key);
$this->buildConfigurationForType($node, $type);
$processor = new Processor();
$config = $processor->process($tree->buildTree(), array($providerConfig));
$configurator = $this->getConfigurator($type);
// hey, we should add the provider service!
$this->configureProvider($container, $type, $key, $configurator->getProviderClass(), $configurator->getPackagistName(), $configurator->getProviderOptions($config), $config['redirect_route'], $config['redirect_params']);
}
}