Completed
Push — migrate_http_cache_configurati... ( ab3b04 )
by
unknown
13:18
created

HttpCache::addSemanticConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 12
nc 1
nop 1
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
4
 * @license For full copyright and license information view LICENSE file distributed with this source code.
5
 */
6
namespace eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser;
7
8
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser;
9
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface;
10
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
11
12
class HttpCache extends AbstractParser
13
{
14
    public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
15
    {
16
        if (isset($scopeSettings['http_cache']['purge_servers'])) {
17
            $contextualizer->setContextualParameter('http_cache.purge_servers', $currentScope, $scopeSettings['http_cache']['purge_servers']);
18
        }
19
    }
20
21
    public function addSemanticConfig(NodeBuilder $nodeBuilder)
22
    {
23
        $nodeBuilder->arrayNode('http_cache')
24
            ->info('Settings related to Http cache (this kernel defined configuration block will be removed in 7.0. Use ezplatform-http-cache for forward compatibility)')
25
            ->children()
26
                ->arrayNode('purge_servers')
27
                    ->info('Servers to use for Http PURGE (will NOT be used if ezpublish.http_cache.purge_type is "local").')
28
                    ->example(array('http://localhost/', 'http://another.server/'))
29
                    ->requiresAtLeastOneElement()
30
                ->prototype('scalar')->end()
31
                ->end()
32
            ->end()
33
        ->end();
34
    }
35
}