本文整理汇总了PHP中Symfony\Component\Config\Definition\Builder\NodeBuilder::scalarNode方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeBuilder::scalarNode方法的具体用法?PHP NodeBuilder::scalarNode怎么用?PHP NodeBuilder::scalarNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Config\Definition\Builder\NodeBuilder
的用法示例。
在下文中一共展示了NodeBuilder::scalarNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addConfiguration
public function addConfiguration(NodeBuilder $node)
{
$node->scalarNode('provider')->end()->booleanNode('remember_me')->defaultTrue()->end()->scalarNode('success_handler')->end()->scalarNode('failure_handler')->end();
foreach ($this->options as $name => $default) {
if (is_bool($default)) {
$node->booleanNode($name)->defaultValue($default);
} else {
$node->scalarNode($name)->defaultValue($default);
}
}
}
示例2: addConfiguration
public function addConfiguration(NodeBuilder $node)
{
$node->scalarNode('key')->isRequired()->cannotBeEmpty()->end()->scalarNode('token_provider')->end();
foreach ($this->options as $name => $value) {
if (is_bool($value)) {
$node->booleanNode($name)->defaultValue($value);
} else {
$node->scalarNode($name)->defaultValue($value);
}
}
}
示例3: addConfiguration
public function addConfiguration(NodeBuilder $builder)
{
$builder
->scalarNode('provider')->end()
->scalarNode('realm')->defaultValue('Secured Area')->end()
;
}
示例4: addOptions
/**
* @param NodeBuilder $nodeBuilder
*
* @return $this
*/
private function addOptions(NodeBuilder $nodeBuilder)
{
// @formatter:off
/** @noinspection PhpUndefinedMethodInspection */
$nodeBuilder->scalarNode('use_revisions')->defaultTrue()->end()->scalarNode('base_host')->isRequired()->end()->scalarNode('base_path')->isRequired()->end();
// @formatter:on
return $this;
}
示例5: addConfiguration
public function addConfiguration(NodeBuilder $builder)
{
$builder
->scalarNode('provider')->end()
->scalarNode('user')->defaultValue('SSL_CLIENT_S_DN_Email')->end()
->scalarNode('credentials')->defaultValue('SSL_CLIENT_S_DN')->end()
;
}
示例6: defineGrammar
/**
* @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder
*/
protected function defineGrammar(NodeBuilder $nodeBuilder)
{
$nodeBuilder->scalarNode('framework')->end()->arrayNode('test_targets')->addDefaultsIfNotSet()->children()->arrayNode('resources')->defaultValue(array(ApplicationContext::getInstance()->getEnvironment()->getWorkingDirectoryAtStartup()))->validate()->ifTrue(function ($v) {
return count($v) == 0;
})->then(function ($v) {
return array(ApplicationContext::getInstance()->getEnvironment()->getWorkingDirectoryAtStartup());
})->end()->prototype('scalar')->cannotBeEmpty()->end()->end()->booleanNode('recursive')->defaultFalse()->end()->arrayNode('methods')->defaultValue(array())->prototype('scalar')->cannotBeEmpty()->end()->end()->arrayNode('classes')->defaultValue(array())->prototype('scalar')->cannotBeEmpty()->end()->end()->scalarNode('file_pattern')->defaultNull()->cannotBeEmpty()->end()->end()->end()->arrayNode('autotest')->addDefaultsIfNotSet()->treatNullLike(array('enabled' => true))->treatTrueLike(array('enabled' => true))->treatFalseLike(array('enabled' => false))->children()->booleanNode('enabled')->defaultFalse()->end()->arrayNode('watch_dirs')->defaultValue(array())->prototype('scalar')->cannotBeEmpty()->end()->end()->end()->end()->booleanNode('notify')->defaultFalse()->end()->arrayNode('junit_xml')->addDefaultsIfNotSet()->beforeNormalization()->ifString()->then(function ($v) {
return array('file' => $v);
})->end()->children()->scalarNode('file')->defaultNull()->cannotBeEmpty()->end()->booleanNode('realtime')->defaultFalse()->end()->end()->end()->booleanNode('stop_on_failure')->defaultFalse()->end()->booleanNode('detailed_progress')->defaultFalse()->end();
}
示例7: addCommonSettings
private function addCommonSettings( NodeBuilder $nodeBuilder )
{
$nodeBuilder
->scalarNode( 'default_provider' )
->info( 'Comments provider you want to use by default (e.g. "disqus").' )
->end()
->arrayNode( 'content_comments' )
->info( 'Rules for comments on Content objects. If none provided, commenting will be allowed for any type of content.' )
->example(
array(
'public_articles' => array(
'enabled' => true,
'provider' => 'facebook',
'match' => array(
'Identifier\\ContentType' => array( 'article', 'blog_post' ),
'Identifier\\Section' => 'standard',
)
),
'private_articles' => array(
'enabled' => true,
'provider' => 'disqus',
'match' => array(
'Identifier\\ContentType' => array( 'article', 'blog_post' ),
'Identifier\\Section' => 'private',
)
)
)
)
->useAttributeAsKey( "my_comment_ruleset" )
->prototype( "array" )
->normalizeKeys( false )
->children()
->booleanNode( "enabled" )->info( "Indicates if comments are enabled or not. Default is true" )->end()
->scalarNode( "provider" )->info( "Provider to use. Default is configured default_provider" )->end()
->arrayNode( "options" )
->info( 'Provider specific options. See available options for your provider.' )
->prototype( 'variable' )->end()
->end()
->arrayNode( "match" )
->info( 'Condition matchers configuration. You can use the same matchers as for selecting content view templates.' )
->example( array( 'Identifier\\Contentype' => array( 'article', 'blog_post' ) ) )
->useAttributeAsKey( "matcher" )
->prototype( "variable" )->end()
->end()
->end()
->end()
->end();
}
示例8: buildConfiguration
public function buildConfiguration(NodeBuilder $node)
{
$node->scalarNode('graph_api_version')->isRequired()->defaultValue('v2.5')->end();
}
示例9: addFieldConfig
/**
* @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $node The node to which to attach the field config to
* @param array $nestings the nested mappings for the current field level
*/
protected function addFieldConfig($node, $nestings)
{
$node->scalarNode('type')->defaultValue('string')->end()->scalarNode('boost')->end()->scalarNode('store')->end()->scalarNode('index')->end()->scalarNode('index_analyzer')->end()->scalarNode('search_analyzer')->end()->scalarNode('analyzer')->end()->scalarNode('term_vector')->end()->scalarNode('null_value')->end()->booleanNode('include_in_all')->defaultValue(true)->end()->booleanNode('enabled')->defaultValue(true)->end()->scalarNode('lat_lon')->end()->scalarNode('index_name')->end()->booleanNode('omit_norms')->end()->scalarNode('index_options')->end()->scalarNode('ignore_above')->end()->scalarNode('position_offset_gap')->end()->arrayNode('_parent')->treatNullLike(array())->children()->scalarNode('type')->end()->scalarNode('identifier')->defaultValue('id')->end()->end()->end()->scalarNode('format')->end()->scalarNode('similarity')->end();
if (isset($nestings['fields'])) {
$this->addNestedFieldConfig($node, $nestings, 'fields');
}
if (isset($nestings['properties'])) {
$this->addNestedFieldConfig($node, $nestings, 'properties');
}
}
示例10: getCoreConfiguration
/**
* @param NodeBuilder $rootNode
*/
private function getCoreConfiguration(NodeBuilder $rootNode)
{
$rootNode->scalarNode('cache_dir')->defaultValue('%kernel.cache_dir%/sulu')->end();
}
示例11: createComposerAutoloadTaskNodes
/**
* Add the nodes for the "composer-autoload" task.
*
* @param NodeBuilder $tasks The node builder.
*
* @return void
*
* @throws \InvalidArgumentException Will be thrown by the nodes when the input was invalid.
*/
private function createComposerAutoloadTaskNodes($tasks)
{
$tasks->scalarNode('optimize')->info('Optimize the autoloader.')->defaultValue(true)->validate()->always(function ($value) {
if (!is_bool($value)) {
throw new \InvalidArgumentException(sprintf('Invalid value %s', json_encode($value)));
}
return $value;
});
}
示例12: appendResourceDefinition
/**
* @param NodeBuilder $attributeDefinition
*/
protected function appendResourceDefinition(NodeBuilder $attributeDefinition)
{
$attributeDefinition->scalarNode('entity')->isRequired()->end()->scalarNode('filesystem_key')->defaultNull()->end()->scalarNode('endpoint')->defaultNull()->end();
}
示例13: addSemanticConfig
/**
* Adds semantic configuration definition.
*
* @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system.<siteaccess>
*
* @return void
*/
public function addSemanticConfig(NodeBuilder $nodeBuilder)
{
$nodeBuilder->scalarNode('repository')->info('The repository to use. Choose among ezpublish.repositories.')->end()->arrayNode('database')->info('DEPRECATED. Use ezpublish.repositories / repository settings instead.')->children()->enumNode('type')->values(array('mysql', 'pgsql', 'sqlite'))->info('The database driver. Can be mysql, pgsql or sqlite.')->end()->scalarNode('server')->end()->scalarNode('port')->end()->scalarNode('user')->cannotBeEmpty()->end()->scalarNode('password')->end()->scalarNode('database_name')->cannotBeEmpty()->end()->scalarNode('charset')->defaultValue('utf8')->end()->scalarNode('socket')->end()->arrayNode('options')->info('Arbitrary options, supported by your DB driver ("driver-opts" in PDO)')->example(array('foo' => 'bar', 'someOptionName' => array('one', 'two', 'three')))->useAttributeAsKey('key')->prototype('variable')->end()->end()->scalarNode('dsn')->info('Full database DSN. Will replace settings above.')->example('mysql://root:root@localhost:3306/ezdemo')->end()->end()->end()->scalarNode('cache_pool_name')->example('ez_site_x')->info('The cache pool name to use for a siteaccess / siteaccess-group, *must* be present under stash.caches: yml config. Default value is "default". NB! Setting is Deprecated, will be made redundant in future version.')->end()->scalarNode('var_dir')->cannotBeEmpty()->example('var/ezdemo_site')->info('The directory relative to web/ where files are stored. Default value is "var"')->end()->scalarNode('storage_dir')->cannotBeEmpty()->info("Directory where to place new files for storage, it's relative to var directory. Default value is 'storage'")->end()->scalarNode('binary_dir')->cannotBeEmpty()->info('Directory where binary files (from ezbinaryfile field type) are stored. Default value is "original"')->end()->booleanNode('legacy_mode')->info('Whether to use legacy mode or not. If true, will let the legacy kernel handle url aliases.')->end()->scalarNode('session_name')->info('DEPRECATED. Use session.name instead.')->end()->arrayNode('session')->info('Session options. Will override options defined in Symfony framework.session.*')->children()->scalarNode('name')->info('The session name. If you want a session name per siteaccess, use "{siteaccess_hash}" token. Will override default session name from framework.session.name')->example(array('session' => array('name' => 'eZSESSID{siteaccess_hash}')))->end()->scalarNode('cookie_lifetime')->end()->scalarNode('cookie_path')->end()->scalarNode('cookie_domain')->end()->booleanNode('cookie_secure')->end()->booleanNode('cookie_httponly')->end()->end()->end()->scalarNode('index_page')->info("The page that the index page will show. Default value is null.")->example('/Getting-Started')->end()->scalarNode('default_page')->info('The default page to show, e.g. after user login this will be used for default redirection. If provided, will override "default_target_path" from security.yml.')->example('/Getting-Started')->end()->arrayNode('http_cache')->info('Settings related to Http cache')->cannotBeEmpty()->children()->arrayNode('purge_servers')->info('Servers to use for Http PURGE (will NOT be used if ezpublish.http_cache.purge_type is "local").')->example(array('http://localhost/', 'http://another.server/'))->requiresAtLeastOneElement()->prototype('scalar')->end()->end()->end()->end()->scalarNode('anonymous_user_id')->cannotBeEmpty()->example('10')->info('The ID of the user used for everyone who is not logged in.')->end()->arrayNode('user')->children()->scalarNode('layout')->info('Layout template to use for user related actions. This is most likely the base pagelayout template of your site.')->example(array('layout' => 'eZDemoBundle::pagelayout.html.twig'))->end()->scalarNode('login_template')->info('Template to use for login form. Defaults to EzPublishCoreBundle:security:login.html.twig')->example(array('login_template' => 'AcmeTestBundle:User:login.html.twig'))->end()->end()->end();
}
示例14: addConfiguration
public function addConfiguration(NodeBuilder $builder)
{
$builder->scalarNode('provider')->end();
}
示例15: buildConfiguration
public function buildConfiguration(NodeBuilder $node)
{
$node->scalarNode('provider_class')->info('The class name of your provider class (e.g. the one that extends AbstractProvider)')->isRequired()->end()->scalarNode('client_class')->info('If you have a sub-class of OAuth2Client you want to use, add it here')->defaultValue('KnpU\\OAuth2ClientBundle\\Client\\OAuth2Client')->end()->arrayNode('provider_options')->info('Other options to pass to your provider\'s constructor')->prototype('variable')->end()->end();
}