Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MergeExtensionConfigurationPass.php

class MergeExtensionConfigurationParameterBag

@internal

Hierarchy

  • class \Symfony\Component\DependencyInjection\ParameterBag\ParameterBag implements \Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface
    • class \Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag extends \Symfony\Component\DependencyInjection\ParameterBag\ParameterBag
      • class \Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationParameterBag extends \Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag

Expanded class hierarchy of MergeExtensionConfigurationParameterBag

File

vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php, line 107

Namespace

Symfony\Component\DependencyInjection\Compiler
View source
class MergeExtensionConfigurationParameterBag extends EnvPlaceholderParameterBag {
    private array $processedEnvPlaceholders;
    public function __construct(parent $parameterBag) {
        parent::__construct($parameterBag->all());
        $this->mergeEnvPlaceholders($parameterBag);
    }
    public function freezeAfterProcessing(Extension $extension, ContainerBuilder $container) : void {
        if (!($config = $extension->getProcessedConfigs())) {
            // Extension::processConfiguration() wasn't called, we cannot know how configs were merged
            return;
        }
        $this->processedEnvPlaceholders = [];
        // serialize config and container to catch env vars nested in object graphs
        $config = serialize($config) . serialize($container->getDefinitions()) . serialize($container->getAliases()) . serialize($container->getParameterBag()
            ->all());
        if (false === stripos($config, 'env_')) {
            return;
        }
        preg_match_all('/env_[a-f0-9]{16}_\\w+_[a-f0-9]{32}/Ui', $config, $matches);
        $usedPlaceholders = array_flip($matches[0]);
        foreach (parent::getEnvPlaceholders() as $env => $placeholders) {
            foreach ($placeholders as $placeholder) {
                if (isset($usedPlaceholders[$placeholder])) {
                    $this->processedEnvPlaceholders[$env] = $placeholders;
                    break;
                }
            }
        }
    }
    public function getEnvPlaceholders() : array {
        return $this->processedEnvPlaceholders ?? parent::getEnvPlaceholders();
    }
    public function getUnusedEnvPlaceholders() : array {
        return !isset($this->processedEnvPlaceholders) ? [] : array_diff_key(parent::getEnvPlaceholders(), $this->processedEnvPlaceholders);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
EnvPlaceholderParameterBag::$counter private static property
EnvPlaceholderParameterBag::$envPlaceholders private property
EnvPlaceholderParameterBag::$envPlaceholderUniquePrefix private property
EnvPlaceholderParameterBag::$providedTypes private property
EnvPlaceholderParameterBag::$unusedEnvPlaceholders private property
EnvPlaceholderParameterBag::clearUnusedEnvPlaceholders public function
EnvPlaceholderParameterBag::get public function Gets a service container parameter. Overrides ParameterBag::get
EnvPlaceholderParameterBag::getEnvPlaceholderUniquePrefix public function Gets the common env placeholder prefix for env vars created by this bag.
EnvPlaceholderParameterBag::getProvidedTypes public function Gets the PHP types corresponding to env() parameter prefixes.
EnvPlaceholderParameterBag::mergeEnvPlaceholders public function Merges the env placeholders of another EnvPlaceholderParameterBag.
EnvPlaceholderParameterBag::resolve public function Replaces parameter placeholders (%name%) by their values for all parameters. Overrides ParameterBag::resolve
EnvPlaceholderParameterBag::setProvidedTypes public function Maps env prefixes to their corresponding PHP types.
MergeExtensionConfigurationParameterBag::$processedEnvPlaceholders private property
MergeExtensionConfigurationParameterBag::freezeAfterProcessing public function
MergeExtensionConfigurationParameterBag::getEnvPlaceholders public function Returns the map of env vars used in the resolved parameter values to their placeholders. Overrides EnvPlaceholderParameterBag::getEnvPlaceholders
MergeExtensionConfigurationParameterBag::getUnusedEnvPlaceholders public function Overrides EnvPlaceholderParameterBag::getUnusedEnvPlaceholders
MergeExtensionConfigurationParameterBag::__construct public function Overrides ParameterBag::__construct
ParameterBag::$deprecatedParameters protected property
ParameterBag::$nonEmptyParameters protected property
ParameterBag::$parameters protected property
ParameterBag::$resolved protected property
ParameterBag::add public function Adds parameters to the service container parameters. Overrides ParameterBagInterface::add 1
ParameterBag::all public function Gets the service container parameters. Overrides ParameterBagInterface::all 1
ParameterBag::allDeprecated public function
ParameterBag::allNonEmpty public function
ParameterBag::cannotBeEmpty public function 1
ParameterBag::clear public function Clears all parameters. Overrides ParameterBagInterface::clear 1
ParameterBag::deprecate public function Deprecates a service container parameter. 1
ParameterBag::escapeValue public function Escape parameter placeholders %. Overrides ParameterBagInterface::escapeValue
ParameterBag::has public function Returns true if a parameter name is defined. Overrides ParameterBagInterface::has 1
ParameterBag::isResolved public function
ParameterBag::remove public function Removes a parameter. Overrides ParameterBagInterface::remove 1
ParameterBag::resolveString public function Resolves parameters inside a string.
ParameterBag::resolveValue public function Replaces parameter placeholders (%name%) by their values. Overrides ParameterBagInterface::resolveValue
ParameterBag::set public function Sets a service container parameter. Overrides ParameterBagInterface::set 1
ParameterBag::unescapeValue public function Unescape parameter placeholders %. Overrides ParameterBagInterface::unescapeValue
RSS feed
Powered by Drupal