[FrameworkBundle] Use canBeEnabled() instead of canBeUnset() for consistency
This commit is contained in:
parent
15b00cc3f8
commit
39723c5126
@ -204,7 +204,7 @@ class Configuration implements ConfigurationInterface
|
||||
->booleanNode('only_master_requests')->defaultFalse()->end()
|
||||
->scalarNode('dsn')->defaultValue('file:%kernel.cache_dir%/profiler')->end()
|
||||
->arrayNode('matcher')
|
||||
->canBeUnset()
|
||||
->canBeEnabled()
|
||||
->performNoDeepMerging()
|
||||
->fixXmlConfig('ip')
|
||||
->children()
|
||||
@ -231,7 +231,7 @@ class Configuration implements ConfigurationInterface
|
||||
->children()
|
||||
->arrayNode('router')
|
||||
->info('router configuration')
|
||||
->canBeUnset()
|
||||
->canBeEnabled()
|
||||
->children()
|
||||
->scalarNode('resource')->isRequired()->end()
|
||||
->scalarNode('type')->end()
|
||||
@ -258,7 +258,7 @@ class Configuration implements ConfigurationInterface
|
||||
->children()
|
||||
->arrayNode('session')
|
||||
->info('session configuration')
|
||||
->canBeUnset()
|
||||
->canBeEnabled()
|
||||
->children()
|
||||
->scalarNode('storage_id')->defaultValue('session.storage.native')->end()
|
||||
->scalarNode('handler_id')->defaultValue('session.handler.native_file')->end()
|
||||
@ -289,7 +289,7 @@ class Configuration implements ConfigurationInterface
|
||||
->children()
|
||||
->arrayNode('request')
|
||||
->info('request configuration')
|
||||
->canBeUnset()
|
||||
->canBeEnabled()
|
||||
->fixXmlConfig('format')
|
||||
->children()
|
||||
->arrayNode('formats')
|
||||
@ -318,7 +318,7 @@ class Configuration implements ConfigurationInterface
|
||||
->children()
|
||||
->arrayNode('templating')
|
||||
->info('templating configuration')
|
||||
->canBeUnset()
|
||||
->canBeEnabled()
|
||||
->children()
|
||||
->scalarNode('hinclude_default_template')->defaultNull()->end()
|
||||
->scalarNode('cache')->end()
|
||||
@ -373,7 +373,7 @@ class Configuration implements ConfigurationInterface
|
||||
->children()
|
||||
->arrayNode('assets')
|
||||
->info('assets configuration')
|
||||
->canBeUnset()
|
||||
->canBeEnabled()
|
||||
->fixXmlConfig('base_url')
|
||||
->children()
|
||||
->scalarNode('version_strategy')->defaultNull()->end()
|
||||
|
@ -83,12 +83,12 @@ class FrameworkExtension extends Extension
|
||||
$loader->load('test.xml');
|
||||
}
|
||||
|
||||
if (isset($config['session'])) {
|
||||
if ($this->isConfigEnabled($container, $config['session'])) {
|
||||
$this->sessionConfigEnabled = true;
|
||||
$this->registerSessionConfiguration($config['session'], $container, $loader);
|
||||
}
|
||||
|
||||
if (isset($config['request'])) {
|
||||
if ($this->isConfigEnabled($container, $config['request'])) {
|
||||
$this->registerRequestConfiguration($config['request'], $container, $loader);
|
||||
}
|
||||
|
||||
@ -104,11 +104,11 @@ class FrameworkExtension extends Extension
|
||||
|
||||
$this->registerSecurityCsrfConfiguration($config['csrf_protection'], $container, $loader);
|
||||
|
||||
if (isset($config['assets'])) {
|
||||
if ($this->isConfigEnabled($container, $config['assets'])) {
|
||||
$this->registerAssetsConfiguration($config['assets'], $container, $loader);
|
||||
}
|
||||
|
||||
if (isset($config['templating'])) {
|
||||
if ($this->isConfigEnabled($container, $config['templating'])) {
|
||||
$this->registerTemplatingConfiguration($config['templating'], $config['ide'], $container, $loader);
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ class FrameworkExtension extends Extension
|
||||
$this->registerTranslatorConfiguration($config['translator'], $container);
|
||||
$this->registerProfilerConfiguration($config['profiler'], $container, $loader);
|
||||
|
||||
if (isset($config['router'])) {
|
||||
if ($this->isConfigEnabled($container, $config['router'])) {
|
||||
$this->registerRouterConfiguration($config['router'], $container, $loader);
|
||||
}
|
||||
|
||||
@ -309,7 +309,7 @@ class FrameworkExtension extends Extension
|
||||
|
||||
$container->setParameter('profiler.storage.dsn', $config['dsn']);
|
||||
|
||||
if (isset($config['matcher'])) {
|
||||
if ($this->isConfigEnabled($container, $config['matcher'])) {
|
||||
if (isset($config['matcher']['service'])) {
|
||||
$container->setAlias('profiler.request_matcher', $config['matcher']['service']);
|
||||
} elseif (isset($config['matcher']['ip']) || isset($config['matcher']['path']) || isset($config['matcher']['ips'])) {
|
||||
@ -890,7 +890,7 @@ class FrameworkExtension extends Extension
|
||||
*/
|
||||
private function registerSerializerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
|
||||
{
|
||||
if (!$config['enabled']) {
|
||||
if (!$this->isConfigEnabled($container, $config)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -974,7 +974,7 @@ class FrameworkExtension extends Extension
|
||||
*/
|
||||
private function registerPropertyInfoConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
|
||||
{
|
||||
if (!$config['enabled']) {
|
||||
if (!$this->isConfigEnabled($container, $config)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -108,6 +108,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
||||
$config = $processor->processConfiguration($configuration, array(array('assets' => null)));
|
||||
|
||||
$defaultConfig = array(
|
||||
'enabled' => true,
|
||||
'version_strategy' => null,
|
||||
'version' => null,
|
||||
'version_format' => '%%s?%%s',
|
||||
@ -193,6 +194,10 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
||||
'only_master_requests' => false,
|
||||
'dsn' => 'file:%kernel.cache_dir%/profiler',
|
||||
'collect' => true,
|
||||
'matcher' => array(
|
||||
'enabled' => false,
|
||||
'ips' => array(),
|
||||
),
|
||||
),
|
||||
'translator' => array(
|
||||
'enabled' => false,
|
||||
@ -223,6 +228,43 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
||||
'property_info' => array(
|
||||
'enabled' => false,
|
||||
),
|
||||
'router' => array(
|
||||
'enabled' => false,
|
||||
'http_port' => 80,
|
||||
'https_port' => 443,
|
||||
'strict_requirements' => true,
|
||||
),
|
||||
'session' => array(
|
||||
'enabled' => false,
|
||||
'storage_id' => 'session.storage.native',
|
||||
'handler_id' => 'session.handler.native_file',
|
||||
'cookie_httponly' => true,
|
||||
'gc_probability' => 1,
|
||||
'save_path' => '%kernel.cache_dir%/sessions',
|
||||
'metadata_update_threshold' => '0',
|
||||
),
|
||||
'request' => array(
|
||||
'enabled' => false,
|
||||
'formats' => array(),
|
||||
),
|
||||
'templating' => array(
|
||||
'enabled' => false,
|
||||
'hinclude_default_template' => null,
|
||||
'form' => array(
|
||||
'resources' => array('FrameworkBundle:Form'),
|
||||
),
|
||||
'engines' => array(),
|
||||
'loaders' => array(),
|
||||
),
|
||||
'assets' => array(
|
||||
'enabled' => false,
|
||||
'version_strategy' => null,
|
||||
'version' => null,
|
||||
'version_format' => '%%s?%%s',
|
||||
'base_path' => '',
|
||||
'base_urls' => array(),
|
||||
'packages' => array(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user