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

DynamicSettingParser.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware;
8
9 use OutOfBoundsException;
10
11 class DynamicSettingParser implements DynamicSettingParserInterface
12 {
13 public function isDynamicSetting($setting)
14 {
15 // Checks if $setting begins and ends with appropriate delimiter.
16 return
17 is_string($setting)
18 && strpos($setting, static::BOUNDARY_DELIMITER) === 0
19 && substr($setting, -1) === static::BOUNDARY_DELIMITER
20 && substr_count($setting, static::BOUNDARY_DELIMITER) == 2
21 && substr_count($setting, static::INNER_DELIMITER) <= 2;
22 }
23
24 public function parseDynamicSetting($setting)
25 {
26 $params = explode(static::INNER_DELIMITER, $this->removeBoundaryDelimiter($setting));
27 if (count($params) > 3) {
28 throw new OutOfBoundsException('Dynamic settings cannot have more than 3 segments: $paramName;namespace;scope$');
29 }
30
31 return [
32 'param' => $params[0],
33 'namespace' => isset($params[1]) ? $params[1] : null,
34 'scope' => isset($params[2]) ? $params[2] : null,
35 ];
36 }
37
43 private function removeBoundaryDelimiter($setting)
44 {
45 return substr($setting, 1, -1);
46 }
47 }
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\DynamicSettingParser
Definition: DynamicSettingParser.php:12
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\DynamicSettingParser\parseDynamicSetting
parseDynamicSetting($setting)
Parses $setting and returns a hash of corresponding arguments.
Definition: DynamicSettingParser.php:24
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\DynamicSettingParser\removeBoundaryDelimiter
removeBoundaryDelimiter($setting)
Definition: DynamicSettingParser.php:43
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\DynamicSettingParser\isDynamicSetting
isDynamicSetting($setting)
Checks if $setting is considered to be dynamic.
Definition: DynamicSettingParser.php:13
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\DynamicSettingParserInterface
Interface for dynamic setting parsers.
Definition: DynamicSettingParserInterface.php:26
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+.