Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

ConfigurationProcessor.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware;
8
9 use Symfony\Component\DependencyInjection\ContainerInterface;
10 use InvalidArgumentException;
11
17 class ConfigurationProcessor
18 {
24 protected static $availableSiteAccesses = [];
25
31 protected static $groupsBySiteAccess = [];
32
38 protected $scopeNodeName;
39
41 protected $contextualizer;
42
43 public function __construct(ContainerInterface $containerBuilder, $namespace, $siteAcccessNodeName = 'system')
44 {
45 $this->contextualizer = $this->buildContextualizer($containerBuilder, $namespace, $siteAcccessNodeName);
46 }
47
56 public static function setAvailableSiteAccesses(array $availableSiteAccesses)
57 {
58 static::$availableSiteAccesses = $availableSiteAccesses;
59 }
60
69 public static function setGroupsBySiteAccess(array $groupsBySiteAccess)
70 {
71 static::$groupsBySiteAccess = $groupsBySiteAccess;
72 }
73
88 public function mapConfig(array $config, $mapper)
89 {
90 $mapperCallable = is_callable($mapper);
91 if (!$mapperCallable && !$mapper instanceof ConfigurationMapperInterface) {
92 throw new InvalidArgumentException('Configuration mapper must either be a callable or an instance of ConfigurationMapper.');
93 }
94
95 if ($mapper instanceof HookableConfigurationMapperInterface) {
96 $mapper->preMap($config, $this->contextualizer);
97 }
98
99 $scopeNodeName = $this->contextualizer->getSiteAccessNodeName();
100 foreach ($config[$scopeNodeName] as $currentScope => &$scopeSettings) {
101 if ($mapperCallable) {
102 call_user_func_array($mapper, [&$scopeSettings, $currentScope, $this->contextualizer]);
103 } else {
104 $mapper->mapConfig($scopeSettings, $currentScope, $this->contextualizer);
105 }
106 }
107
108 if ($mapper instanceof HookableConfigurationMapperInterface) {
109 $mapper->postMap($config, $this->contextualizer);
110 }
111 }
112
121 public function mapSetting($id, array $config)
122 {
123 $this->contextualizer->mapSetting($id, $config);
124 }
125
135 public function mapConfigArray($id, array $config, $options = 0)
136 {
137 $this->contextualizer->mapConfigArray($id, $config, $options);
138 }
139
152 protected function buildContextualizer(ContainerInterface $containerBuilder, $namespace, $siteAccessNodeName)
153 {
154 return new Contextualizer($containerBuilder, $namespace, $siteAccessNodeName, static::$availableSiteAccesses, static::$groupsBySiteAccess);
155 }
156
160 public function setContextualizer(ContextualizerInterface $contextualizer)
161 {
162 $this->contextualizer = $contextualizer;
163 }
164
168 public function getContextualizer()
169 {
170 return $this->contextualizer;
171 }
172 }
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor
Processor for SiteAccess aware configuration processing.
Definition: ConfigurationProcessor.php:18
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor\mapSetting
mapSetting($id, array $config)
Proxy to Contextualizer::mapSetting().
Definition: ConfigurationProcessor.php:121
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor\getContextualizer
getContextualizer()
Definition: ConfigurationProcessor.php:168
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor\setContextualizer
setContextualizer(ContextualizerInterface $contextualizer)
Definition: ConfigurationProcessor.php:160
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor\$availableSiteAccesses
static $availableSiteAccesses
Definition: ConfigurationProcessor.php:24
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor\mapConfig
mapConfig(array $config, $mapper)
Triggers mapping process between semantic and internal configuration.
Definition: ConfigurationProcessor.php:88
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor\mapConfigArray
mapConfigArray($id, array $config, $options=0)
Proxy to Contextualizer::mapConfigArray().
Definition: ConfigurationProcessor.php:135
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor\$groupsBySiteAccess
static $groupsBySiteAccess
Definition: ConfigurationProcessor.php:31
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor\__construct
__construct(ContainerInterface $containerBuilder, $namespace, $siteAcccessNodeName='system')
Definition: ConfigurationProcessor.php:43
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor\$scopeNodeName
$scopeNodeName
Definition: ConfigurationProcessor.php:38
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor\setAvailableSiteAccesses
static setAvailableSiteAccesses(array $availableSiteAccesses)
Injects available SiteAccesses.
Definition: ConfigurationProcessor.php:56
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor\buildContextualizer
buildContextualizer(ContainerInterface $containerBuilder, $namespace, $siteAccessNodeName)
Builds configuration contextualizer (I know, sounds obvious...).
Definition: ConfigurationProcessor.php:152
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor\$contextualizer
$contextualizer
Definition: ConfigurationProcessor.php:41
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor\setGroupsBySiteAccess
static setGroupsBySiteAccess(array $groupsBySiteAccess)
Injects available scope groups, indexed by scope.
Definition: ConfigurationProcessor.php:69
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\Contextualizer
Definition: Contextualizer.php:13
$containerBuilder
if(!isset($installDir)) $containerBuilder
Definition: containerBuilder.php:19
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface
Definition: ContextualizerInterface.php:12
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationMapperInterface
ConfigurationMapper purpose is to map parsed semantic configuration for given scope (SiteAccess,...
Definition: ConfigurationMapperInterface.php:18
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\HookableConfigurationMapperInterface
Interface of ConfigurationMapper objects that need to trigger actions before and/or after looping ove...
Definition: HookableConfigurationMapperInterface.php:14
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware
Definition: EzPublishCoreBundle/DependencyInjection/Configuration/SiteAccessAware/Configuration.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.