Deprecated: Return type of Google\Model::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 256

Deprecated: Return type of Google\Model::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 261

Deprecated: Return type of Google\Model::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 268

Deprecated: Return type of Google\Model::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 278

Deprecated: Return type of Google\Collection::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 22

Deprecated: Return type of Google\Collection::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 38

Deprecated: Return type of Google\Collection::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 30

Deprecated: Return type of Google\Collection::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 43

Deprecated: Return type of Google\Collection::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 14

Deprecated: Return type of Google\Collection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 49
Symfony Profiler

vendor/symfony/framework-bundle/DependencyInjection/Configuration.php line 165

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
  11. use Doctrine\Common\Annotations\Annotation;
  12. use Doctrine\Common\Cache\Cache;
  13. use Doctrine\DBAL\Connection;
  14. use Symfony\Bundle\FullStack;
  15. use Symfony\Component\Asset\Package;
  16. use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
  17. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  18. use Symfony\Component\Config\Definition\ConfigurationInterface;
  19. use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
  20. use Symfony\Component\DependencyInjection\Exception\LogicException;
  21. use Symfony\Component\Form\Form;
  22. use Symfony\Component\HttpClient\HttpClient;
  23. use Symfony\Component\HttpFoundation\Cookie;
  24. use Symfony\Component\Lock\Lock;
  25. use Symfony\Component\Lock\Store\SemaphoreStore;
  26. use Symfony\Component\Mailer\Mailer;
  27. use Symfony\Component\Messenger\MessageBusInterface;
  28. use Symfony\Component\Notifier\Notifier;
  29. use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
  30. use Symfony\Component\Serializer\Serializer;
  31. use Symfony\Component\Translation\Translator;
  32. use Symfony\Component\Validator\Validation;
  33. use Symfony\Component\WebLink\HttpHeaderSerializer;
  34. /**
  35.  * FrameworkExtension configuration structure.
  36.  *
  37.  * @author Jeremy Mikola <jmikola@gmail.com>
  38.  * @author GrĂ©goire Pineau <lyrixx@lyrixx.info>
  39.  */
  40. class Configuration implements ConfigurationInterface
  41. {
  42.     private $debug;
  43.     /**
  44.      * @param bool $debug Whether debugging is enabled or not
  45.      */
  46.     public function __construct(bool $debug)
  47.     {
  48.         $this->debug $debug;
  49.     }
  50.     /**
  51.      * Generates the configuration tree builder.
  52.      *
  53.      * @return TreeBuilder The tree builder
  54.      */
  55.     public function getConfigTreeBuilder()
  56.     {
  57.         $treeBuilder = new TreeBuilder('framework');
  58.         $rootNode $treeBuilder->getRootNode();
  59.         $rootNode
  60.             ->beforeNormalization()
  61.                 ->ifTrue(function ($v) { return !isset($v['assets']) && isset($v['templating']) && class_exists(Package::class); })
  62.                 ->then(function ($v) {
  63.                     $v['assets'] = [];
  64.                     return $v;
  65.                 })
  66.             ->end()
  67.             ->children()
  68.                 ->scalarNode('secret')->end()
  69.                 ->scalarNode('http_method_override')
  70.                     ->info("Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests. Note: When using the HttpCache, you need to call the method in your front controller instead")
  71.                     ->defaultTrue()
  72.                 ->end()
  73.                 ->scalarNode('ide')->defaultNull()->end()
  74.                 ->booleanNode('test')->end()
  75.                 ->scalarNode('default_locale')->defaultValue('en')->end()
  76.                 ->arrayNode('trusted_hosts')
  77.                     ->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end()
  78.                     ->prototype('scalar')->end()
  79.                 ->end()
  80.                 ->scalarNode('error_controller')
  81.                     ->defaultValue('error_controller')
  82.                 ->end()
  83.             ->end()
  84.         ;
  85.         $this->addCsrfSection($rootNode);
  86.         $this->addFormSection($rootNode);
  87.         $this->addEsiSection($rootNode);
  88.         $this->addSsiSection($rootNode);
  89.         $this->addFragmentsSection($rootNode);
  90.         $this->addProfilerSection($rootNode);
  91.         $this->addWorkflowSection($rootNode);
  92.         $this->addRouterSection($rootNode);
  93.         $this->addSessionSection($rootNode);
  94.         $this->addRequestSection($rootNode);
  95.         $this->addAssetsSection($rootNode);
  96.         $this->addTranslatorSection($rootNode);
  97.         $this->addValidationSection($rootNode);
  98.         $this->addAnnotationsSection($rootNode);
  99.         $this->addSerializerSection($rootNode);
  100.         $this->addPropertyAccessSection($rootNode);
  101.         $this->addPropertyInfoSection($rootNode);
  102.         $this->addCacheSection($rootNode);
  103.         $this->addPhpErrorsSection($rootNode);
  104.         $this->addWebLinkSection($rootNode);
  105.         $this->addLockSection($rootNode);
  106.         $this->addMessengerSection($rootNode);
  107.         $this->addRobotsIndexSection($rootNode);
  108.         $this->addHttpClientSection($rootNode);
  109.         $this->addMailerSection($rootNode);
  110.         $this->addSecretsSection($rootNode);
  111.         $this->addNotifierSection($rootNode);
  112.         return $treeBuilder;
  113.     }
  114.     private function addSecretsSection(ArrayNodeDefinition $rootNode)
  115.     {
  116.         $rootNode
  117.             ->children()
  118.                 ->arrayNode('secrets')
  119.                     ->canBeDisabled()
  120.                     ->children()
  121.                         ->scalarNode('vault_directory')->defaultValue('%kernel.project_dir%/config/secrets/%kernel.environment%')->cannotBeEmpty()->end()
  122.                         ->scalarNode('local_dotenv_file')->defaultValue('%kernel.project_dir%/.env.%kernel.environment%.local')->end()
  123.                         ->scalarNode('decryption_env_var')->defaultValue('base64:default::SYMFONY_DECRYPTION_SECRET')->end()
  124.                     ->end()
  125.                 ->end()
  126.             ->end()
  127.         ;
  128.     }
  129.     private function addCsrfSection(ArrayNodeDefinition $rootNode)
  130.     {
  131.         $rootNode
  132.             ->children()
  133.                 ->arrayNode('csrf_protection')
  134.                     ->treatFalseLike(['enabled' => false])
  135.                     ->treatTrueLike(['enabled' => true])
  136.                     ->treatNullLike(['enabled' => true])
  137.                     ->addDefaultsIfNotSet()
  138.                     ->children()
  139.                         // defaults to framework.session.enabled && !class_exists(FullStack::class) && interface_exists(CsrfTokenManagerInterface::class)
  140.                         ->booleanNode('enabled')->defaultNull()->end()
  141.                     ->end()
  142.                 ->end()
  143.             ->end()
  144.         ;
  145.     }
  146.     private function addFormSection(ArrayNodeDefinition $rootNode)
  147.     {
  148.         $rootNode
  149.             ->children()
  150.                 ->arrayNode('form')
  151.                     ->info('form configuration')
  152.                     ->{!class_exists(FullStack::class) && class_exists(Form::class) ? 'canBeDisabled' 'canBeEnabled'}()
  153.                     ->children()
  154.                         ->arrayNode('csrf_protection')
  155.                             ->treatFalseLike(['enabled' => false])
  156.                             ->treatTrueLike(['enabled' => true])
  157.                             ->treatNullLike(['enabled' => true])
  158.                             ->addDefaultsIfNotSet()
  159.                             ->children()
  160.                                 ->booleanNode('enabled')->defaultNull()->end() // defaults to framework.csrf_protection.enabled
  161.                                 ->scalarNode('field_name')->defaultValue('_token')->end()
  162.                             ->end()
  163.                         ->end()
  164.                     ->end()
  165.                 ->end()
  166.             ->end()
  167.         ;
  168.     }
  169.     private function addEsiSection(ArrayNodeDefinition $rootNode)
  170.     {
  171.         $rootNode
  172.             ->children()
  173.                 ->arrayNode('esi')
  174.                     ->info('esi configuration')
  175.                     ->canBeEnabled()
  176.                 ->end()
  177.             ->end()
  178.         ;
  179.     }
  180.     private function addSsiSection(ArrayNodeDefinition $rootNode)
  181.     {
  182.         $rootNode
  183.             ->children()
  184.                 ->arrayNode('ssi')
  185.                     ->info('ssi configuration')
  186.                     ->canBeEnabled()
  187.                 ->end()
  188.             ->end();
  189.     }
  190.     private function addFragmentsSection(ArrayNodeDefinition $rootNode)
  191.     {
  192.         $rootNode
  193.             ->children()
  194.                 ->arrayNode('fragments')
  195.                     ->info('fragments configuration')
  196.                     ->canBeEnabled()
  197.                     ->children()
  198.                         ->scalarNode('hinclude_default_template')->defaultNull()->end()
  199.                         ->scalarNode('path')->defaultValue('/_fragment')->end()
  200.                     ->end()
  201.                 ->end()
  202.             ->end()
  203.         ;
  204.     }
  205.     private function addProfilerSection(ArrayNodeDefinition $rootNode)
  206.     {
  207.         $rootNode
  208.             ->children()
  209.                 ->arrayNode('profiler')
  210.                     ->info('profiler configuration')
  211.                     ->canBeEnabled()
  212.                     ->children()
  213.                         ->booleanNode('collect')->defaultTrue()->end()
  214.                         ->booleanNode('only_exceptions')->defaultFalse()->end()
  215.                         ->booleanNode('only_master_requests')->defaultFalse()->end()
  216.                         ->scalarNode('dsn')->defaultValue('file:%kernel.cache_dir%/profiler')->end()
  217.                     ->end()
  218.                 ->end()
  219.             ->end()
  220.         ;
  221.     }
  222.     private function addWorkflowSection(ArrayNodeDefinition $rootNode)
  223.     {
  224.         $rootNode
  225.             ->fixXmlConfig('workflow')
  226.             ->children()
  227.                 ->arrayNode('workflows')
  228.                     ->canBeEnabled()
  229.                     ->beforeNormalization()
  230.                         ->always(function ($v) {
  231.                             if (\is_array($v) && true === $v['enabled']) {
  232.                                 $workflows $v;
  233.                                 unset($workflows['enabled']);
  234.                                 if (=== \count($workflows) && isset($workflows[0]['enabled']) && === \count($workflows[0])) {
  235.                                     $workflows = [];
  236.                                 }
  237.                                 if (=== \count($workflows) && isset($workflows['workflows']) && array_keys($workflows['workflows']) !== range(0\count($workflows) - 1) && !empty(array_diff(array_keys($workflows['workflows']), ['audit_trail''type''marking_store''supports''support_strategy''initial_marking''places''transitions']))) {
  238.                                     $workflows $workflows['workflows'];
  239.                                 }
  240.                                 foreach ($workflows as $key => $workflow) {
  241.                                     if (isset($workflow['enabled']) && false === $workflow['enabled']) {
  242.                                         throw new LogicException(sprintf('Cannot disable a single workflow. Remove the configuration for the workflow "%s" instead.'$workflow['name']));
  243.                                     }
  244.                                     unset($workflows[$key]['enabled']);
  245.                                 }
  246.                                 $v = [
  247.                                     'enabled' => true,
  248.                                     'workflows' => $workflows,
  249.                                 ];
  250.                             }
  251.                             return $v;
  252.                         })
  253.                     ->end()
  254.                     ->children()
  255.                         ->arrayNode('workflows')
  256.                             ->useAttributeAsKey('name')
  257.                             ->prototype('array')
  258.                                 ->fixXmlConfig('support')
  259.                                 ->fixXmlConfig('place')
  260.                                 ->fixXmlConfig('transition')
  261.                                 ->children()
  262.                                     ->arrayNode('audit_trail')
  263.                                         ->canBeEnabled()
  264.                                     ->end()
  265.                                     ->enumNode('type')
  266.                                         ->values(['workflow''state_machine'])
  267.                                         ->defaultValue('state_machine')
  268.                                     ->end()
  269.                                     ->arrayNode('marking_store')
  270.                                         ->children()
  271.                                             ->enumNode('type')
  272.                                                 ->values(['method'])
  273.                                             ->end()
  274.                                             ->scalarNode('property')
  275.                                                 ->defaultValue('marking')
  276.                                             ->end()
  277.                                             ->scalarNode('service')
  278.                                                 ->cannotBeEmpty()
  279.                                             ->end()
  280.                                         ->end()
  281.                                     ->end()
  282.                                     ->arrayNode('supports')
  283.                                         ->beforeNormalization()
  284.                                             ->ifString()
  285.                                             ->then(function ($v) { return [$v]; })
  286.                                         ->end()
  287.                                         ->prototype('scalar')
  288.                                             ->cannotBeEmpty()
  289.                                             ->validate()
  290.                                                 ->ifTrue(function ($v) { return !class_exists($v) && !interface_exists($vfalse); })
  291.                                                 ->thenInvalid('The supported class or interface "%s" does not exist.')
  292.                                             ->end()
  293.                                         ->end()
  294.                                     ->end()
  295.                                     ->scalarNode('support_strategy')
  296.                                         ->cannotBeEmpty()
  297.                                     ->end()
  298.                                     ->arrayNode('initial_marking')
  299.                                         ->beforeNormalization()->castToArray()->end()
  300.                                         ->defaultValue([])
  301.                                         ->prototype('scalar')->end()
  302.                                     ->end()
  303.                                     ->arrayNode('places')
  304.                                         ->beforeNormalization()
  305.                                             ->always()
  306.                                             ->then(function ($places) {
  307.                                                 // It's an indexed array of shape  ['place1', 'place2']
  308.                                                 if (isset($places[0]) && \is_string($places[0])) {
  309.                                                     return array_map(function (string $place) {
  310.                                                         return ['name' => $place];
  311.                                                     }, $places);
  312.                                                 }
  313.                                                 // It's an indexed array, we let the validation occur
  314.                                                 if (isset($places[0]) && \is_array($places[0])) {
  315.                                                     return $places;
  316.                                                 }
  317.                                                 foreach ($places as $name => $place) {
  318.                                                     if (\is_array($place) && \array_key_exists('name'$place)) {
  319.                                                         continue;
  320.                                                     }
  321.                                                     $place['name'] = $name;
  322.                                                     $places[$name] = $place;
  323.                                                 }
  324.                                                 return array_values($places);
  325.                                             })
  326.                                         ->end()
  327.                                         ->isRequired()
  328.                                         ->requiresAtLeastOneElement()
  329.                                         ->prototype('array')
  330.                                             ->children()
  331.                                                 ->scalarNode('name')
  332.                                                     ->isRequired()
  333.                                                     ->cannotBeEmpty()
  334.                                                 ->end()
  335.                                                 ->arrayNode('metadata')
  336.                                                     ->normalizeKeys(false)
  337.                                                     ->defaultValue([])
  338.                                                     ->example(['color' => 'blue''description' => 'Workflow to manage article.'])
  339.                                                     ->prototype('variable')
  340.                                                     ->end()
  341.                                                 ->end()
  342.                                             ->end()
  343.                                         ->end()
  344.                                     ->end()
  345.                                     ->arrayNode('transitions')
  346.                                         ->beforeNormalization()
  347.                                             ->always()
  348.                                             ->then(function ($transitions) {
  349.                                                 // It's an indexed array, we let the validation occur
  350.                                                 if (isset($transitions[0]) && \is_array($transitions[0])) {
  351.                                                     return $transitions;
  352.                                                 }
  353.                                                 foreach ($transitions as $name => $transition) {
  354.                                                     if (\is_array($transition) && \array_key_exists('name'$transition)) {
  355.                                                         continue;
  356.                                                     }
  357.                                                     $transition['name'] = $name;
  358.                                                     $transitions[$name] = $transition;
  359.                                                 }
  360.                                                 return $transitions;
  361.                                             })
  362.                                         ->end()
  363.                                         ->isRequired()
  364.                                         ->requiresAtLeastOneElement()
  365.                                         ->prototype('array')
  366.                                             ->children()
  367.                                                 ->scalarNode('name')
  368.                                                     ->isRequired()
  369.                                                     ->cannotBeEmpty()
  370.                                                 ->end()
  371.                                                 ->scalarNode('guard')
  372.                                                     ->cannotBeEmpty()
  373.                                                     ->info('An expression to block the transition')
  374.                                                     ->example('is_fully_authenticated() and is_granted(\'ROLE_JOURNALIST\') and subject.getTitle() == \'My first article\'')
  375.                                                 ->end()
  376.                                                 ->arrayNode('from')
  377.                                                     ->beforeNormalization()
  378.                                                         ->ifString()
  379.                                                         ->then(function ($v) { return [$v]; })
  380.                                                     ->end()
  381.                                                     ->requiresAtLeastOneElement()
  382.                                                     ->prototype('scalar')
  383.                                                         ->cannotBeEmpty()
  384.                                                     ->end()
  385.                                                 ->end()
  386.                                                 ->arrayNode('to')
  387.                                                     ->beforeNormalization()
  388.                                                         ->ifString()
  389.                                                         ->then(function ($v) { return [$v]; })
  390.                                                     ->end()
  391.                                                     ->requiresAtLeastOneElement()
  392.                                                     ->prototype('scalar')
  393.                                                         ->cannotBeEmpty()
  394.                                                     ->end()
  395.                                                 ->end()
  396.                                                 ->arrayNode('metadata')
  397.                                                     ->normalizeKeys(false)
  398.                                                     ->defaultValue([])
  399.                                                     ->example(['color' => 'blue''description' => 'Workflow to manage article.'])
  400.                                                     ->prototype('variable')
  401.                                                     ->end()
  402.                                                 ->end()
  403.                                             ->end()
  404.                                         ->end()
  405.                                     ->end()
  406.                                     ->arrayNode('metadata')
  407.                                         ->normalizeKeys(false)
  408.                                         ->defaultValue([])
  409.                                         ->example(['color' => 'blue''description' => 'Workflow to manage article.'])
  410.                                         ->prototype('variable')
  411.                                         ->end()
  412.                                     ->end()
  413.                                 ->end()
  414.                                 ->validate()
  415.                                     ->ifTrue(function ($v) {
  416.                                         return $v['supports'] && isset($v['support_strategy']);
  417.                                     })
  418.                                     ->thenInvalid('"supports" and "support_strategy" cannot be used together.')
  419.                                 ->end()
  420.                                 ->validate()
  421.                                     ->ifTrue(function ($v) {
  422.                                         return !$v['supports'] && !isset($v['support_strategy']);
  423.                                     })
  424.                                     ->thenInvalid('"supports" or "support_strategy" should be configured.')
  425.                                 ->end()
  426.                             ->end()
  427.                         ->end()
  428.                     ->end()
  429.                 ->end()
  430.             ->end()
  431.         ;
  432.     }
  433.     private function addRouterSection(ArrayNodeDefinition $rootNode)
  434.     {
  435.         $rootNode
  436.             ->children()
  437.                 ->arrayNode('router')
  438.                     ->info('router configuration')
  439.                     ->canBeEnabled()
  440.                     ->children()
  441.                         ->scalarNode('resource')->isRequired()->end()
  442.                         ->scalarNode('type')->end()
  443.                         ->scalarNode('default_uri')
  444.                             ->info('The default URI used to generate URLs in a non-HTTP context')
  445.                             ->defaultNull()
  446.                         ->end()
  447.                         ->scalarNode('http_port')->defaultValue(80)->end()
  448.                         ->scalarNode('https_port')->defaultValue(443)->end()
  449.                         ->scalarNode('strict_requirements')
  450.                             ->info(
  451.                                 "set to true to throw an exception when a parameter does not match the requirements\n".
  452.                                 "set to false to disable exceptions when a parameter does not match the requirements (and return null instead)\n".
  453.                                 "set to null to disable parameter checks against requirements\n".
  454.                                 "'true' is the preferred configuration in development mode, while 'false' or 'null' might be preferred in production"
  455.                             )
  456.                             ->defaultTrue()
  457.                         ->end()
  458.                         ->booleanNode('utf8')->defaultNull()->end()
  459.                     ->end()
  460.                 ->end()
  461.             ->end()
  462.         ;
  463.     }
  464.     private function addSessionSection(ArrayNodeDefinition $rootNode)
  465.     {
  466.         $rootNode
  467.             ->children()
  468.                 ->arrayNode('session')
  469.                     ->info('session configuration')
  470.                     ->canBeEnabled()
  471.                     ->children()
  472.                         ->scalarNode('storage_id')->defaultValue('session.storage.native')->end()
  473.                         ->scalarNode('handler_id')->defaultValue('session.handler.native_file')->end()
  474.                         ->scalarNode('name')
  475.                             ->validate()
  476.                                 ->ifTrue(function ($v) {
  477.                                     parse_str($v$parsed);
  478.                                     return implode('&'array_keys($parsed)) !== (string) $v;
  479.                                 })
  480.                                 ->thenInvalid('Session name %s contains illegal character(s)')
  481.                             ->end()
  482.                         ->end()
  483.                         ->scalarNode('cookie_lifetime')->end()
  484.                         ->scalarNode('cookie_path')->end()
  485.                         ->scalarNode('cookie_domain')->end()
  486.                         ->enumNode('cookie_secure')->values([truefalse'auto'])->end()
  487.                         ->booleanNode('cookie_httponly')->defaultTrue()->end()
  488.                         ->enumNode('cookie_samesite')->values([nullCookie::SAMESITE_LAXCookie::SAMESITE_STRICTCookie::SAMESITE_NONE])->defaultNull()->end()
  489.                         ->booleanNode('use_cookies')->end()
  490.                         ->scalarNode('gc_divisor')->end()
  491.                         ->scalarNode('gc_probability')->defaultValue(1)->end()
  492.                         ->scalarNode('gc_maxlifetime')->end()
  493.                         ->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end()
  494.                         ->integerNode('metadata_update_threshold')
  495.                             ->defaultValue(0)
  496.                             ->info('seconds to wait between 2 session metadata updates')
  497.                         ->end()
  498.                         ->integerNode('sid_length')
  499.                             ->min(22)
  500.                             ->max(256)
  501.                         ->end()
  502.                         ->integerNode('sid_bits_per_character')
  503.                             ->min(4)
  504.                             ->max(6)
  505.                         ->end()
  506.                     ->end()
  507.                 ->end()
  508.             ->end()
  509.         ;
  510.     }
  511.     private function addRequestSection(ArrayNodeDefinition $rootNode)
  512.     {
  513.         $rootNode
  514.             ->children()
  515.                 ->arrayNode('request')
  516.                     ->info('request configuration')
  517.                     ->canBeEnabled()
  518.                     ->fixXmlConfig('format')
  519.                     ->children()
  520.                         ->arrayNode('formats')
  521.                             ->useAttributeAsKey('name')
  522.                             ->prototype('array')
  523.                                 ->beforeNormalization()
  524.                                     ->ifTrue(function ($v) { return \is_array($v) && isset($v['mime_type']); })
  525.                                     ->then(function ($v) { return $v['mime_type']; })
  526.                                 ->end()
  527.                                 ->beforeNormalization()->castToArray()->end()
  528.                                 ->prototype('scalar')->end()
  529.                             ->end()
  530.                         ->end()
  531.                     ->end()
  532.                 ->end()
  533.             ->end()
  534.         ;
  535.     }
  536.     private function addAssetsSection(ArrayNodeDefinition $rootNode)
  537.     {
  538.         $rootNode
  539.             ->children()
  540.                 ->arrayNode('assets')
  541.                     ->info('assets configuration')
  542.                     ->{!class_exists(FullStack::class) && class_exists(Package::class) ? 'canBeDisabled' 'canBeEnabled'}()
  543.                     ->fixXmlConfig('base_url')
  544.                     ->children()
  545.                         ->scalarNode('version_strategy')->defaultNull()->end()
  546.                         ->scalarNode('version')->defaultNull()->end()
  547.                         ->scalarNode('version_format')->defaultValue('%%s?%%s')->end()
  548.                         ->scalarNode('json_manifest_path')->defaultNull()->end()
  549.                         ->scalarNode('base_path')->defaultValue('')->end()
  550.                         ->arrayNode('base_urls')
  551.                             ->requiresAtLeastOneElement()
  552.                             ->beforeNormalization()->castToArray()->end()
  553.                             ->prototype('scalar')->end()
  554.                         ->end()
  555.                     ->end()
  556.                     ->validate()
  557.                         ->ifTrue(function ($v) {
  558.                             return isset($v['version_strategy']) && isset($v['version']);
  559.                         })
  560.                         ->thenInvalid('You cannot use both "version_strategy" and "version" at the same time under "assets".')
  561.                     ->end()
  562.                     ->validate()
  563.                         ->ifTrue(function ($v) {
  564.                             return isset($v['version_strategy']) && isset($v['json_manifest_path']);
  565.                         })
  566.                         ->thenInvalid('You cannot use both "version_strategy" and "json_manifest_path" at the same time under "assets".')
  567.                     ->end()
  568.                     ->validate()
  569.                         ->ifTrue(function ($v) {
  570.                             return isset($v['version']) && isset($v['json_manifest_path']);
  571.                         })
  572.                         ->thenInvalid('You cannot use both "version" and "json_manifest_path" at the same time under "assets".')
  573.                     ->end()
  574.                     ->fixXmlConfig('package')
  575.                     ->children()
  576.                         ->arrayNode('packages')
  577.                             ->normalizeKeys(false)
  578.                             ->useAttributeAsKey('name')
  579.                             ->prototype('array')
  580.                                 ->fixXmlConfig('base_url')
  581.                                 ->children()
  582.                                     ->scalarNode('version_strategy')->defaultNull()->end()
  583.                                     ->scalarNode('version')
  584.                                         ->beforeNormalization()
  585.                                         ->ifTrue(function ($v) { return '' === $v; })
  586.                                         ->then(function ($v) { return; })
  587.                                         ->end()
  588.                                     ->end()
  589.                                     ->scalarNode('version_format')->defaultNull()->end()
  590.                                     ->scalarNode('json_manifest_path')->defaultNull()->end()
  591.                                     ->scalarNode('base_path')->defaultValue('')->end()
  592.                                     ->arrayNode('base_urls')
  593.                                         ->requiresAtLeastOneElement()
  594.                                         ->beforeNormalization()->castToArray()->end()
  595.                                         ->prototype('scalar')->end()
  596.                                     ->end()
  597.                                 ->end()
  598.                                 ->validate()
  599.                                     ->ifTrue(function ($v) {
  600.                                         return isset($v['version_strategy']) && isset($v['version']);
  601.                                     })
  602.                                     ->thenInvalid('You cannot use both "version_strategy" and "version" at the same time under "assets" packages.')
  603.                                 ->end()
  604.                                 ->validate()
  605.                                     ->ifTrue(function ($v) {
  606.                                         return isset($v['version_strategy']) && isset($v['json_manifest_path']);
  607.                                     })
  608.                                     ->thenInvalid('You cannot use both "version_strategy" and "json_manifest_path" at the same time under "assets" packages.')
  609.                                 ->end()
  610.                                 ->validate()
  611.                                     ->ifTrue(function ($v) {
  612.                                         return isset($v['version']) && isset($v['json_manifest_path']);
  613.                                     })
  614.                                     ->thenInvalid('You cannot use both "version" and "json_manifest_path" at the same time under "assets" packages.')
  615.                                 ->end()
  616.                             ->end()
  617.                         ->end()
  618.                     ->end()
  619.                 ->end()
  620.             ->end()
  621.         ;
  622.     }
  623.     private function addTranslatorSection(ArrayNodeDefinition $rootNode)
  624.     {
  625.         $rootNode
  626.             ->children()
  627.                 ->arrayNode('translator')
  628.                     ->info('translator configuration')
  629.                     ->{!class_exists(FullStack::class) && class_exists(Translator::class) ? 'canBeDisabled' 'canBeEnabled'}()
  630.                     ->fixXmlConfig('fallback')
  631.                     ->fixXmlConfig('path')
  632.                     ->fixXmlConfig('enabled_locale')
  633.                     ->children()
  634.                         ->arrayNode('fallbacks')
  635.                             ->info('Defaults to the value of "default_locale".')
  636.                             ->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end()
  637.                             ->prototype('scalar')->end()
  638.                             ->defaultValue([])
  639.                         ->end()
  640.                         ->booleanNode('logging')->defaultValue(false)->end()
  641.                         ->scalarNode('formatter')->defaultValue('translator.formatter.default')->end()
  642.                         ->scalarNode('cache_dir')->defaultValue('%kernel.cache_dir%/translations')->end()
  643.                         ->scalarNode('default_path')
  644.                             ->info('The default path used to load translations')
  645.                             ->defaultValue('%kernel.project_dir%/translations')
  646.                         ->end()
  647.                         ->arrayNode('paths')
  648.                             ->prototype('scalar')->end()
  649.                         ->end()
  650.                         ->arrayNode('enabled_locales')
  651.                             ->prototype('scalar')->end()
  652.                             ->defaultValue([])
  653.                         ->end()
  654.                     ->end()
  655.                 ->end()
  656.             ->end()
  657.         ;
  658.     }
  659.     private function addValidationSection(ArrayNodeDefinition $rootNode)
  660.     {
  661.         $rootNode
  662.             ->children()
  663.                 ->arrayNode('validation')
  664.                     ->info('validation configuration')
  665.                     ->{!class_exists(FullStack::class) && class_exists(Validation::class) ? 'canBeDisabled' 'canBeEnabled'}()
  666.                     ->children()
  667.                         ->scalarNode('cache')->end()
  668.                         ->booleanNode('enable_annotations')->{!class_exists(FullStack::class) && class_exists(Annotation::class) ? 'defaultTrue' 'defaultFalse'}()->end()
  669.                         ->arrayNode('static_method')
  670.                             ->defaultValue(['loadValidatorMetadata'])
  671.                             ->prototype('scalar')->end()
  672.                             ->treatFalseLike([])
  673.                             ->validate()->castToArray()->end()
  674.                         ->end()
  675.                         ->scalarNode('translation_domain')->defaultValue('validators')->end()
  676.                         ->enumNode('email_validation_mode')->values(['html5''loose''strict'])->end()
  677.                         ->arrayNode('mapping')
  678.                             ->addDefaultsIfNotSet()
  679.                             ->fixXmlConfig('path')
  680.                             ->children()
  681.                                 ->arrayNode('paths')
  682.                                     ->prototype('scalar')->end()
  683.                                 ->end()
  684.                             ->end()
  685.                         ->end()
  686.                         ->arrayNode('not_compromised_password')
  687.                             ->canBeDisabled()
  688.                             ->children()
  689.                                 ->booleanNode('enabled')
  690.                                     ->defaultTrue()
  691.                                     ->info('When disabled, compromised passwords will be accepted as valid.')
  692.                                 ->end()
  693.                                 ->scalarNode('endpoint')
  694.                                     ->defaultNull()
  695.                                     ->info('API endpoint for the NotCompromisedPassword Validator.')
  696.                                 ->end()
  697.                             ->end()
  698.                         ->end()
  699.                         ->arrayNode('auto_mapping')
  700.                             ->info('A collection of namespaces for which auto-mapping will be enabled by default, or null to opt-in with the EnableAutoMapping constraint.')
  701.                             ->example([
  702.                                 'App\\Entity\\' => [],
  703.                                 'App\\WithSpecificLoaders\\' => ['validator.property_info_loader'],
  704.                             ])
  705.                             ->useAttributeAsKey('namespace')
  706.                             ->normalizeKeys(false)
  707.                             ->beforeNormalization()
  708.                                 ->ifArray()
  709.                                 ->then(function (array $values): array {
  710.                                     foreach ($values as $k => $v) {
  711.                                         if (isset($v['service'])) {
  712.                                             continue;
  713.                                         }
  714.                                         if (isset($v['namespace'])) {
  715.                                             $values[$k]['services'] = [];
  716.                                             continue;
  717.                                         }
  718.                                         if (!\is_array($v)) {
  719.                                             $values[$v]['services'] = [];
  720.                                             unset($values[$k]);
  721.                                             continue;
  722.                                         }
  723.                                         $tmp $v;
  724.                                         unset($values[$k]);
  725.                                         $values[$k]['services'] = $tmp;
  726.                                     }
  727.                                     return $values;
  728.                                 })
  729.                             ->end()
  730.                             ->arrayPrototype()
  731.                                 ->fixXmlConfig('service')
  732.                                 ->children()
  733.                                     ->arrayNode('services')
  734.                                         ->prototype('scalar')->end()
  735.                                     ->end()
  736.                                 ->end()
  737.                             ->end()
  738.                         ->end()
  739.                     ->end()
  740.                 ->end()
  741.             ->end()
  742.         ;
  743.     }
  744.     private function addAnnotationsSection(ArrayNodeDefinition $rootNode)
  745.     {
  746.         $rootNode
  747.             ->children()
  748.                 ->arrayNode('annotations')
  749.                     ->info('annotation configuration')
  750.                     ->{class_exists(Annotation::class) ? 'canBeDisabled' 'canBeEnabled'}()
  751.                     ->children()
  752.                         ->scalarNode('cache')->defaultValue(interface_exists(Cache::class) ? 'php_array' 'none')->end()
  753.                         ->scalarNode('file_cache_dir')->defaultValue('%kernel.cache_dir%/annotations')->end()
  754.                         ->booleanNode('debug')->defaultValue($this->debug)->end()
  755.                     ->end()
  756.                 ->end()
  757.             ->end()
  758.         ;
  759.     }
  760.     private function addSerializerSection(ArrayNodeDefinition $rootNode)
  761.     {
  762.         $rootNode
  763.             ->children()
  764.                 ->arrayNode('serializer')
  765.                     ->info('serializer configuration')
  766.                     ->{!class_exists(FullStack::class) && class_exists(Serializer::class) ? 'canBeDisabled' 'canBeEnabled'}()
  767.                     ->children()
  768.                         ->booleanNode('enable_annotations')->{!class_exists(FullStack::class) && class_exists(Annotation::class) ? 'defaultTrue' 'defaultFalse'}()->end()
  769.                         ->scalarNode('name_converter')->end()
  770.                         ->scalarNode('circular_reference_handler')->end()
  771.                         ->scalarNode('max_depth_handler')->end()
  772.                         ->arrayNode('mapping')
  773.                             ->addDefaultsIfNotSet()
  774.                             ->fixXmlConfig('path')
  775.                             ->children()
  776.                                 ->arrayNode('paths')
  777.                                     ->prototype('scalar')->end()
  778.                                 ->end()
  779.                             ->end()
  780.                         ->end()
  781.                     ->end()
  782.                 ->end()
  783.             ->end()
  784.         ;
  785.     }
  786.     private function addPropertyAccessSection(ArrayNodeDefinition $rootNode)
  787.     {
  788.         $rootNode
  789.             ->children()
  790.                 ->arrayNode('property_access')
  791.                     ->addDefaultsIfNotSet()
  792.                     ->info('Property access configuration')
  793.                     ->children()
  794.                         ->booleanNode('magic_call')->defaultFalse()->end()
  795.                         ->booleanNode('throw_exception_on_invalid_index')->defaultFalse()->end()
  796.                         ->booleanNode('throw_exception_on_invalid_property_path')->defaultTrue()->end()
  797.                     ->end()
  798.                 ->end()
  799.             ->end()
  800.         ;
  801.     }
  802.     private function addPropertyInfoSection(ArrayNodeDefinition $rootNode)
  803.     {
  804.         $rootNode
  805.             ->children()
  806.                 ->arrayNode('property_info')
  807.                     ->info('Property info configuration')
  808.                     ->{!class_exists(FullStack::class) && interface_exists(PropertyInfoExtractorInterface::class) ? 'canBeDisabled' 'canBeEnabled'}()
  809.                 ->end()
  810.             ->end()
  811.         ;
  812.     }
  813.     private function addCacheSection(ArrayNodeDefinition $rootNode)
  814.     {
  815.         $rootNode
  816.             ->children()
  817.                 ->arrayNode('cache')
  818.                     ->info('Cache configuration')
  819.                     ->addDefaultsIfNotSet()
  820.                     ->fixXmlConfig('pool')
  821.                     ->children()
  822.                         ->scalarNode('prefix_seed')
  823.                             ->info('Used to namespace cache keys when using several apps with the same shared backend')
  824.                             ->example('my-application-name')
  825.                         ->end()
  826.                         ->scalarNode('app')
  827.                             ->info('App related cache pools configuration')
  828.                             ->defaultValue('cache.adapter.filesystem')
  829.                         ->end()
  830.                         ->scalarNode('system')
  831.                             ->info('System related cache pools configuration')
  832.                             ->defaultValue('cache.adapter.system')
  833.                         ->end()
  834.                         ->scalarNode('directory')->defaultValue('%kernel.cache_dir%/pools')->end()
  835.                         ->scalarNode('default_doctrine_provider')->end()
  836.                         ->scalarNode('default_psr6_provider')->end()
  837.                         ->scalarNode('default_redis_provider')->defaultValue('redis://localhost')->end()
  838.                         ->scalarNode('default_memcached_provider')->defaultValue('memcached://localhost')->end()
  839.                         ->scalarNode('default_pdo_provider')->defaultValue(class_exists(Connection::class) ? 'database_connection' null)->end()
  840.                         ->arrayNode('pools')
  841.                             ->useAttributeAsKey('name')
  842.                             ->prototype('array')
  843.                                 ->fixXmlConfig('adapter')
  844.                                 ->beforeNormalization()
  845.                                     ->ifTrue(function ($v) { return (isset($v['adapters']) || \is_array($v['adapter'] ?? null)) && isset($v['provider']); })
  846.                                     ->thenInvalid('Pool cannot have a "provider" while "adapter" is set to a map')
  847.                                 ->end()
  848.                                 ->children()
  849.                                     ->arrayNode('adapters')
  850.                                         ->performNoDeepMerging()
  851.                                         ->info('One or more adapters to chain for creating the pool, defaults to "cache.app".')
  852.                                         ->beforeNormalization()
  853.                                             ->always()->then(function ($values) {
  854.                                                 if ([0] === array_keys($values) && \is_array($values[0])) {
  855.                                                     return $values[0];
  856.                                                 }
  857.                                                 $adapters = [];
  858.                                                 foreach ($values as $k => $v) {
  859.                                                     if (\is_int($k) && \is_string($v)) {
  860.                                                         $adapters[] = $v;
  861.                                                     } elseif (!\is_array($v)) {
  862.                                                         $adapters[$k] = $v;
  863.                                                     } elseif (isset($v['provider'])) {
  864.                                                         $adapters[$v['provider']] = $v['name'] ?? $v;
  865.                                                     } else {
  866.                                                         $adapters[] = $v['name'] ?? $v;
  867.                                                     }
  868.                                                 }
  869.                                                 return $adapters;
  870.                                             })
  871.                                         ->end()
  872.                                         ->prototype('scalar')->end()
  873.                                     ->end()
  874.                                     ->scalarNode('tags')->defaultNull()->end()
  875.                                     ->booleanNode('public')->defaultFalse()->end()
  876.                                     ->integerNode('default_lifetime')->end()
  877.                                     ->scalarNode('provider')
  878.                                         ->info('Overwrite the setting from the default provider for this adapter.')
  879.                                     ->end()
  880.                                     ->scalarNode('clearer')->end()
  881.                                 ->end()
  882.                             ->end()
  883.                             ->validate()
  884.                                 ->ifTrue(function ($v) { return isset($v['cache.app']) || isset($v['cache.system']); })
  885.                                 ->thenInvalid('"cache.app" and "cache.system" are reserved names')
  886.                             ->end()
  887.                         ->end()
  888.                     ->end()
  889.                 ->end()
  890.             ->end()
  891.         ;
  892.     }
  893.     private function addPhpErrorsSection(ArrayNodeDefinition $rootNode)
  894.     {
  895.         $rootNode
  896.             ->children()
  897.                 ->arrayNode('php_errors')
  898.                     ->info('PHP errors handling configuration')
  899.                     ->addDefaultsIfNotSet()
  900.                     ->children()
  901.                         ->scalarNode('log')
  902.                             ->info('Use the application logger instead of the PHP logger for logging PHP errors.')
  903.                             ->example('"true" to use the default configuration: log all errors. "false" to disable. An integer bit field of E_* constants.')
  904.                             ->defaultValue($this->debug)
  905.                             ->treatNullLike($this->debug)
  906.                             ->validate()
  907.                                 ->ifTrue(function ($v) { return !(\is_int($v) || \is_bool($v)); })
  908.                                 ->thenInvalid('The "php_errors.log" parameter should be either an integer or a boolean.')
  909.                             ->end()
  910.                         ->end()
  911.                         ->booleanNode('throw')
  912.                             ->info('Throw PHP errors as \ErrorException instances.')
  913.                             ->defaultValue($this->debug)
  914.                             ->treatNullLike($this->debug)
  915.                         ->end()
  916.                     ->end()
  917.                 ->end()
  918.             ->end()
  919.         ;
  920.     }
  921.     private function addLockSection(ArrayNodeDefinition $rootNode)
  922.     {
  923.         $rootNode
  924.             ->children()
  925.                 ->arrayNode('lock')
  926.                     ->info('Lock configuration')
  927.                     ->{!class_exists(FullStack::class) && class_exists(Lock::class) ? 'canBeDisabled' 'canBeEnabled'}()
  928.                     ->beforeNormalization()
  929.                         ->ifString()->then(function ($v) { return ['enabled' => true'resources' => $v]; })
  930.                     ->end()
  931.                     ->beforeNormalization()
  932.                         ->ifTrue(function ($v) { return \is_array($v) && !isset($v['enabled']); })
  933.                         ->then(function ($v) { return $v + ['enabled' => true]; })
  934.                     ->end()
  935.                     ->beforeNormalization()
  936.                         ->ifTrue(function ($v) { return \is_array($v) && !isset($v['resources']) && !isset($v['resource']); })
  937.                         ->then(function ($v) {
  938.                             $e $v['enabled'];
  939.                             unset($v['enabled']);
  940.                             return ['enabled' => $e'resources' => $v];
  941.                         })
  942.                     ->end()
  943.                     ->addDefaultsIfNotSet()
  944.                     ->fixXmlConfig('resource')
  945.                     ->children()
  946.                         ->arrayNode('resources')
  947.                             ->normalizeKeys(false)
  948.                             ->useAttributeAsKey('name')
  949.                             ->requiresAtLeastOneElement()
  950.                             ->defaultValue(['default' => [class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphore' 'flock']])
  951.                             ->beforeNormalization()
  952.                                 ->ifString()->then(function ($v) { return ['default' => $v]; })
  953.                             ->end()
  954.                             ->beforeNormalization()
  955.                                 ->ifTrue(function ($v) { return \is_array($v) && array_keys($v) === range(0\count($v) - 1); })
  956.                                 ->then(function ($v) {
  957.                                     $resources = [];
  958.                                     foreach ($v as $resource) {
  959.                                         $resources array_merge_recursive(
  960.                                             $resources,
  961.                                             \is_array($resource) && isset($resource['name'])
  962.                                                 ? [$resource['name'] => $resource['value']]
  963.                                                 : ['default' => $resource]
  964.                                         );
  965.                                     }
  966.                                     return $resources;
  967.                                 })
  968.                             ->end()
  969.                             ->prototype('array')
  970.                                 ->performNoDeepMerging()
  971.                                 ->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end()
  972.                                 ->prototype('scalar')->end()
  973.                             ->end()
  974.                         ->end()
  975.                     ->end()
  976.                 ->end()
  977.             ->end()
  978.         ;
  979.     }
  980.     private function addWebLinkSection(ArrayNodeDefinition $rootNode)
  981.     {
  982.         $rootNode
  983.             ->children()
  984.                 ->arrayNode('web_link')
  985.                     ->info('web links configuration')
  986.                     ->{!class_exists(FullStack::class) && class_exists(HttpHeaderSerializer::class) ? 'canBeDisabled' 'canBeEnabled'}()
  987.                 ->end()
  988.             ->end()
  989.         ;
  990.     }
  991.     private function addMessengerSection(ArrayNodeDefinition $rootNode)
  992.     {
  993.         $rootNode
  994.             ->children()
  995.                 ->arrayNode('messenger')
  996.                     ->info('Messenger configuration')
  997.                     ->{!class_exists(FullStack::class) && interface_exists(MessageBusInterface::class) ? 'canBeDisabled' 'canBeEnabled'}()
  998.                     ->fixXmlConfig('transport')
  999.                     ->fixXmlConfig('bus''buses')
  1000.                     ->validate()
  1001.                         ->ifTrue(function ($v) { return isset($v['buses']) && \count($v['buses']) > && null === $v['default_bus']; })
  1002.                         ->thenInvalid('You must specify the "default_bus" if you define more than one bus.')
  1003.                     ->end()
  1004.                     ->validate()
  1005.                         ->ifTrue(static function ($v): bool { return isset($v['buses']) && null !== $v['default_bus'] && !isset($v['buses'][$v['default_bus']]); })
  1006.                         ->then(static function (array $v): void { throw new InvalidConfigurationException(sprintf('The specified default bus "%s" is not configured. Available buses are "%s".'$v['default_bus'], implode('", "'array_keys($v['buses'])))); })
  1007.                     ->end()
  1008.                     ->children()
  1009.                         ->arrayNode('routing')
  1010.                             ->normalizeKeys(false)
  1011.                             ->useAttributeAsKey('message_class')
  1012.                             ->beforeNormalization()
  1013.                                 ->always()
  1014.                                 ->then(function ($config) {
  1015.                                     if (!\is_array($config)) {
  1016.                                         return [];
  1017.                                     }
  1018.                                     // If XML config with only one routing attribute
  1019.                                     if (=== \count($config) && isset($config['message-class']) && isset($config['sender'])) {
  1020.                                         $config = [=> $config];
  1021.                                     }
  1022.                                     $newConfig = [];
  1023.                                     foreach ($config as $k => $v) {
  1024.                                         if (!\is_int($k)) {
  1025.                                             $newConfig[$k] = [
  1026.                                                 'senders' => $v['senders'] ?? (\is_array($v) ? array_values($v) : [$v]),
  1027.                                             ];
  1028.                                         } else {
  1029.                                             $newConfig[$v['message-class']]['senders'] = array_map(
  1030.                                                 function ($a) {
  1031.                                                     return \is_string($a) ? $a $a['service'];
  1032.                                                 },
  1033.                                                 array_values($v['sender'])
  1034.                                             );
  1035.                                         }
  1036.                                     }
  1037.                                     return $newConfig;
  1038.                                 })
  1039.                             ->end()
  1040.                             ->prototype('array')
  1041.                                 ->performNoDeepMerging()
  1042.                                 ->children()
  1043.                                     ->arrayNode('senders')
  1044.                                         ->requiresAtLeastOneElement()
  1045.                                         ->prototype('scalar')->end()
  1046.                                     ->end()
  1047.                                 ->end()
  1048.                             ->end()
  1049.                         ->end()
  1050.                         ->arrayNode('serializer')
  1051.                             ->addDefaultsIfNotSet()
  1052.                             ->children()
  1053.                                 ->scalarNode('default_serializer')
  1054.                                     ->defaultValue('messenger.transport.native_php_serializer')
  1055.                                     ->info('Service id to use as the default serializer for the transports.')
  1056.                                 ->end()
  1057.                                 ->arrayNode('symfony_serializer')
  1058.                                     ->addDefaultsIfNotSet()
  1059.                                     ->children()
  1060.                                         ->scalarNode('format')->defaultValue('json')->info('Serialization format for the messenger.transport.symfony_serializer service (which is not the serializer used by default).')->end()
  1061.                                         ->arrayNode('context')
  1062.                                             ->normalizeKeys(false)
  1063.                                             ->useAttributeAsKey('name')
  1064.                                             ->defaultValue([])
  1065.                                             ->info('Context array for the messenger.transport.symfony_serializer service (which is not the serializer used by default).')
  1066.                                             ->prototype('variable')->end()
  1067.                                         ->end()
  1068.                                     ->end()
  1069.                                 ->end()
  1070.                             ->end()
  1071.                         ->end()
  1072.                         ->arrayNode('transports')
  1073.                             ->normalizeKeys(false)
  1074.                             ->useAttributeAsKey('name')
  1075.                             ->arrayPrototype()
  1076.                                 ->beforeNormalization()
  1077.                                     ->ifString()
  1078.                                     ->then(function (string $dsn) {
  1079.                                         return ['dsn' => $dsn];
  1080.                                     })
  1081.                                 ->end()
  1082.                                 ->fixXmlConfig('option')
  1083.                                 ->children()
  1084.                                     ->scalarNode('dsn')->end()
  1085.                                     ->scalarNode('serializer')->defaultNull()->info('Service id of a custom serializer to use.')->end()
  1086.                                     ->arrayNode('options')
  1087.                                         ->normalizeKeys(false)
  1088.                                         ->defaultValue([])
  1089.                                         ->prototype('variable')
  1090.                                         ->end()
  1091.                                     ->end()
  1092.                                     ->arrayNode('retry_strategy')
  1093.                                         ->addDefaultsIfNotSet()
  1094.                                         ->beforeNormalization()
  1095.                                             ->always(function ($v) {
  1096.                                                 if (isset($v['service']) && (isset($v['max_retries']) || isset($v['delay']) || isset($v['multiplier']) || isset($v['max_delay']))) {
  1097.                                                     throw new \InvalidArgumentException('The "service" cannot be used along with the other "retry_strategy" options.');
  1098.                                                 }
  1099.                                                 return $v;
  1100.                                             })
  1101.                                         ->end()
  1102.                                         ->children()
  1103.                                             ->scalarNode('service')->defaultNull()->info('Service id to override the retry strategy entirely')->end()
  1104.                                             ->integerNode('max_retries')->defaultValue(3)->min(0)->end()
  1105.                                             ->integerNode('delay')->defaultValue(1000)->min(0)->info('Time in ms to delay (or the initial value when multiplier is used)')->end()
  1106.                                             ->floatNode('multiplier')->defaultValue(2)->min(1)->info('If greater than 1, delay will grow exponentially for each retry: this delay = (delay * (multiple ^ retries))')->end()
  1107.                                             ->integerNode('max_delay')->defaultValue(0)->min(0)->info('Max time in ms that a retry should ever be delayed (0 = infinite)')->end()
  1108.                                         ->end()
  1109.                                     ->end()
  1110.                                 ->end()
  1111.                             ->end()
  1112.                         ->end()
  1113.                         ->scalarNode('failure_transport')
  1114.                             ->defaultNull()
  1115.                             ->info('Transport name to send failed messages to (after all retries have failed).')
  1116.                         ->end()
  1117.                         ->scalarNode('default_bus')->defaultNull()->end()
  1118.                         ->arrayNode('buses')
  1119.                             ->defaultValue(['messenger.bus.default' => ['default_middleware' => true'middleware' => []]])
  1120.                             ->normalizeKeys(false)
  1121.                             ->useAttributeAsKey('name')
  1122.                             ->arrayPrototype()
  1123.                                 ->addDefaultsIfNotSet()
  1124.                                 ->children()
  1125.                                     ->enumNode('default_middleware')
  1126.                                         ->values([truefalse'allow_no_handlers'])
  1127.                                         ->defaultTrue()
  1128.                                     ->end()
  1129.                                     ->arrayNode('middleware')
  1130.                                         ->performNoDeepMerging()
  1131.                                         ->beforeNormalization()
  1132.                                             ->ifTrue(function ($v) { return \is_string($v) || (\is_array($v) && !\is_int(key($v))); })
  1133.                                             ->then(function ($v) { return [$v]; })
  1134.                                         ->end()
  1135.                                         ->defaultValue([])
  1136.                                         ->arrayPrototype()
  1137.                                             ->beforeNormalization()
  1138.                                                 ->always()
  1139.                                                 ->then(function ($middleware): array {
  1140.                                                     if (!\is_array($middleware)) {
  1141.                                                         return ['id' => $middleware];
  1142.                                                     }
  1143.                                                     if (isset($middleware['id'])) {
  1144.                                                         return $middleware;
  1145.                                                     }
  1146.                                                     if (\count($middleware)) {
  1147.                                                         throw new \InvalidArgumentException('Invalid middleware at path "framework.messenger": a map with a single factory id as key and its arguments as value was expected, '.json_encode($middleware).' given.');
  1148.                                                     }
  1149.                                                     return [
  1150.                                                         'id' => key($middleware),
  1151.                                                         'arguments' => current($middleware),
  1152.                                                     ];
  1153.                                                 })
  1154.                                             ->end()
  1155.                                             ->fixXmlConfig('argument')
  1156.                                             ->children()
  1157.                                                 ->scalarNode('id')->isRequired()->cannotBeEmpty()->end()
  1158.                                                 ->arrayNode('arguments')
  1159.                                                     ->normalizeKeys(false)
  1160.                                                     ->defaultValue([])
  1161.                                                     ->prototype('variable')
  1162.                                                 ->end()
  1163.                                             ->end()
  1164.                                         ->end()
  1165.                                     ->end()
  1166.                                 ->end()
  1167.                             ->end()
  1168.                         ->end()
  1169.                     ->end()
  1170.                 ->end()
  1171.             ->end()
  1172.         ;
  1173.     }
  1174.     private function addRobotsIndexSection(ArrayNodeDefinition $rootNode)
  1175.     {
  1176.         $rootNode
  1177.             ->children()
  1178.                 ->booleanNode('disallow_search_engine_index')
  1179.                     ->info('Enabled by default when debug is enabled.')
  1180.                     ->defaultValue($this->debug)
  1181.                     ->treatNullLike($this->debug)
  1182.                 ->end()
  1183.             ->end()
  1184.         ;
  1185.     }
  1186.     private function addHttpClientSection(ArrayNodeDefinition $rootNode)
  1187.     {
  1188.         $rootNode
  1189.             ->children()
  1190.                 ->arrayNode('http_client')
  1191.                     ->info('HTTP Client configuration')
  1192.                     ->{!class_exists(FullStack::class) && class_exists(HttpClient::class) ? 'canBeDisabled' 'canBeEnabled'}()
  1193.                     ->fixXmlConfig('scoped_client')
  1194.                     ->children()
  1195.                         ->integerNode('max_host_connections')
  1196.                             ->info('The maximum number of connections to a single host.')
  1197.                         ->end()
  1198.                         ->arrayNode('default_options')
  1199.                             ->fixXmlConfig('header')
  1200.                             ->children()
  1201.                                 ->arrayNode('headers')
  1202.                                     ->info('Associative array: header => value(s).')
  1203.                                     ->useAttributeAsKey('name')
  1204.                                     ->normalizeKeys(false)
  1205.                                     ->variablePrototype()->end()
  1206.                                 ->end()
  1207.                                 ->integerNode('max_redirects')
  1208.                                     ->info('The maximum number of redirects to follow.')
  1209.                                 ->end()
  1210.                                 ->scalarNode('http_version')
  1211.                                     ->info('The default HTTP version, typically 1.1 or 2.0, leave to null for the best version.')
  1212.                                 ->end()
  1213.                                 ->arrayNode('resolve')
  1214.                                     ->info('Associative array: domain => IP.')
  1215.                                     ->useAttributeAsKey('host')
  1216.                                     ->beforeNormalization()
  1217.                                         ->always(function ($config) {
  1218.                                             if (!\is_array($config)) {
  1219.                                                 return [];
  1220.                                             }
  1221.                                             if (!isset($config['host'], $config['value']) || \count($config) > 2) {
  1222.                                                 return $config;
  1223.                                             }
  1224.                                             return [$config['host'] => $config['value']];
  1225.                                         })
  1226.                                     ->end()
  1227.                                     ->normalizeKeys(false)
  1228.                                     ->scalarPrototype()->end()
  1229.                                 ->end()
  1230.                                 ->scalarNode('proxy')
  1231.                                     ->info('The URL of the proxy to pass requests through or null for automatic detection.')
  1232.                                 ->end()
  1233.                                 ->scalarNode('no_proxy')
  1234.                                     ->info('A comma separated list of hosts that do not require a proxy to be reached.')
  1235.                                 ->end()
  1236.                                 ->floatNode('timeout')
  1237.                                     ->info('The idle timeout, defaults to the "default_socket_timeout" ini parameter.')
  1238.                                 ->end()
  1239.                                 ->floatNode('max_duration')
  1240.                                     ->info('The maximum execution time for the request+response as a whole.')
  1241.                                 ->end()
  1242.                                 ->scalarNode('bindto')
  1243.                                     ->info('A network interface name, IP address, a host name or a UNIX socket to bind to.')
  1244.                                 ->end()
  1245.                                 ->booleanNode('verify_peer')
  1246.                                     ->info('Indicates if the peer should be verified in a SSL/TLS context.')
  1247.                                 ->end()
  1248.                                 ->booleanNode('verify_host')
  1249.                                     ->info('Indicates if the host should exist as a certificate common name.')
  1250.                                 ->end()
  1251.                                 ->scalarNode('cafile')
  1252.                                     ->info('A certificate authority file.')
  1253.                                 ->end()
  1254.                                 ->scalarNode('capath')
  1255.                                     ->info('A directory that contains multiple certificate authority files.')
  1256.                                 ->end()
  1257.                                 ->scalarNode('local_cert')
  1258.                                     ->info('A PEM formatted certificate file.')
  1259.                                 ->end()
  1260.                                 ->scalarNode('local_pk')
  1261.                                     ->info('A private key file.')
  1262.                                 ->end()
  1263.                                 ->scalarNode('passphrase')
  1264.                                     ->info('The passphrase used to encrypt the "local_pk" file.')
  1265.                                 ->end()
  1266.                                 ->scalarNode('ciphers')
  1267.                                     ->info('A list of SSL/TLS ciphers separated by colons, commas or spaces (e.g. "RC3-SHA:TLS13-AES-128-GCM-SHA256"...)')
  1268.                                 ->end()
  1269.                                 ->arrayNode('peer_fingerprint')
  1270.                                     ->info('Associative array: hashing algorithm => hash(es).')
  1271.                                     ->normalizeKeys(false)
  1272.                                     ->children()
  1273.                                         ->variableNode('sha1')->end()
  1274.                                         ->variableNode('pin-sha256')->end()
  1275.                                         ->variableNode('md5')->end()
  1276.                                     ->end()
  1277.                                 ->end()
  1278.                             ->end()
  1279.                         ->end()
  1280.                         ->arrayNode('scoped_clients')
  1281.                             ->useAttributeAsKey('name')
  1282.                             ->normalizeKeys(false)
  1283.                             ->arrayPrototype()
  1284.                                 ->fixXmlConfig('header')
  1285.                                 ->beforeNormalization()
  1286.                                     ->always()
  1287.                                     ->then(function ($config) {
  1288.                                         if (!class_exists(HttpClient::class)) {
  1289.                                             throw new LogicException('HttpClient support cannot be enabled as the component is not installed. Try running "composer require symfony/http-client".');
  1290.                                         }
  1291.                                         return \is_array($config) ? $config : ['base_uri' => $config];
  1292.                                     })
  1293.                                 ->end()
  1294.                                 ->validate()
  1295.                                     ->ifTrue(function ($v) { return !isset($v['scope']) && !isset($v['base_uri']); })
  1296.                                     ->thenInvalid('Either "scope" or "base_uri" should be defined.')
  1297.                                 ->end()
  1298.                                 ->validate()
  1299.                                     ->ifTrue(function ($v) { return !empty($v['query']) && !isset($v['base_uri']); })
  1300.                                     ->thenInvalid('"query" applies to "base_uri" but no base URI is defined.')
  1301.                                 ->end()
  1302.                                 ->children()
  1303.                                     ->scalarNode('scope')
  1304.                                         ->info('The regular expression that the request URL must match before adding the other options. When none is provided, the base URI is used instead.')
  1305.                                         ->cannotBeEmpty()
  1306.                                     ->end()
  1307.                                     ->scalarNode('base_uri')
  1308.                                         ->info('The URI to resolve relative URLs, following rules in RFC 3985, section 2.')
  1309.                                         ->cannotBeEmpty()
  1310.                                     ->end()
  1311.                                     ->scalarNode('auth_basic')
  1312.                                         ->info('An HTTP Basic authentication "username:password".')
  1313.                                     ->end()
  1314.                                     ->scalarNode('auth_bearer')
  1315.                                         ->info('A token enabling HTTP Bearer authorization.')
  1316.                                     ->end()
  1317.                                     ->scalarNode('auth_ntlm')
  1318.                                         ->info('A "username:password" pair to use Microsoft NTLM authentication (requires the cURL extension).')
  1319.                                     ->end()
  1320.                                     ->arrayNode('query')
  1321.                                         ->info('Associative array of query string values merged with the base URI.')
  1322.                                         ->useAttributeAsKey('key')
  1323.                                         ->beforeNormalization()
  1324.                                             ->always(function ($config) {
  1325.                                                 if (!\is_array($config)) {
  1326.                                                     return [];
  1327.                                                 }
  1328.                                                 if (!isset($config['key'], $config['value']) || \count($config) > 2) {
  1329.                                                     return $config;
  1330.                                                 }
  1331.                                                 return [$config['key'] => $config['value']];
  1332.                                             })
  1333.                                         ->end()
  1334.                                         ->normalizeKeys(false)
  1335.                                         ->scalarPrototype()->end()
  1336.                                     ->end()
  1337.                                     ->arrayNode('headers')
  1338.                                         ->info('Associative array: header => value(s).')
  1339.                                         ->useAttributeAsKey('name')
  1340.                                         ->normalizeKeys(false)
  1341.                                         ->variablePrototype()->end()
  1342.                                     ->end()
  1343.                                     ->integerNode('max_redirects')
  1344.                                         ->info('The maximum number of redirects to follow.')
  1345.                                     ->end()
  1346.                                     ->scalarNode('http_version')
  1347.                                         ->info('The default HTTP version, typically 1.1 or 2.0, leave to null for the best version.')
  1348.                                     ->end()
  1349.                                     ->arrayNode('resolve')
  1350.                                         ->info('Associative array: domain => IP.')
  1351.                                         ->useAttributeAsKey('host')
  1352.                                         ->beforeNormalization()
  1353.                                             ->always(function ($config) {
  1354.                                                 if (!\is_array($config)) {
  1355.                                                     return [];
  1356.                                                 }
  1357.                                                 if (!isset($config['host'], $config['value']) || \count($config) > 2) {
  1358.                                                     return $config;
  1359.                                                 }
  1360.                                                 return [$config['host'] => $config['value']];
  1361.                                             })
  1362.                                         ->end()
  1363.                                         ->normalizeKeys(false)
  1364.                                         ->scalarPrototype()->end()
  1365.                                     ->end()
  1366.                                     ->scalarNode('proxy')
  1367.                                         ->info('The URL of the proxy to pass requests through or null for automatic detection.')
  1368.                                     ->end()
  1369.                                     ->scalarNode('no_proxy')
  1370.                                         ->info('A comma separated list of hosts that do not require a proxy to be reached.')
  1371.                                     ->end()
  1372.                                     ->floatNode('timeout')
  1373.                                         ->info('The idle timeout, defaults to the "default_socket_timeout" ini parameter.')
  1374.                                     ->end()
  1375.                                     ->floatNode('max_duration')
  1376.                                         ->info('The maximum execution time for the request+response as a whole.')
  1377.                                     ->end()
  1378.                                     ->scalarNode('bindto')
  1379.                                         ->info('A network interface name, IP address, a host name or a UNIX socket to bind to.')
  1380.                                     ->end()
  1381.                                     ->booleanNode('verify_peer')
  1382.                                         ->info('Indicates if the peer should be verified in a SSL/TLS context.')
  1383.                                     ->end()
  1384.                                     ->booleanNode('verify_host')
  1385.                                         ->info('Indicates if the host should exist as a certificate common name.')
  1386.                                     ->end()
  1387.                                     ->scalarNode('cafile')
  1388.                                         ->info('A certificate authority file.')
  1389.                                     ->end()
  1390.                                     ->scalarNode('capath')
  1391.                                         ->info('A directory that contains multiple certificate authority files.')
  1392.                                     ->end()
  1393.                                     ->scalarNode('local_cert')
  1394.                                         ->info('A PEM formatted certificate file.')
  1395.                                     ->end()
  1396.                                     ->scalarNode('local_pk')
  1397.                                         ->info('A private key file.')
  1398.                                     ->end()
  1399.                                     ->scalarNode('passphrase')
  1400.                                         ->info('The passphrase used to encrypt the "local_pk" file.')
  1401.                                     ->end()
  1402.                                     ->scalarNode('ciphers')
  1403.                                         ->info('A list of SSL/TLS ciphers separated by colons, commas or spaces (e.g. "RC3-SHA:TLS13-AES-128-GCM-SHA256"...)')
  1404.                                     ->end()
  1405.                                     ->arrayNode('peer_fingerprint')
  1406.                                         ->info('Associative array: hashing algorithm => hash(es).')
  1407.                                         ->normalizeKeys(false)
  1408.                                         ->children()
  1409.                                             ->variableNode('sha1')->end()
  1410.                                             ->variableNode('pin-sha256')->end()
  1411.                                             ->variableNode('md5')->end()
  1412.                                         ->end()
  1413.                                     ->end()
  1414.                                 ->end()
  1415.                             ->end()
  1416.                         ->end()
  1417.                     ->end()
  1418.                 ->end()
  1419.             ->end()
  1420.         ;
  1421.     }
  1422.     private function addMailerSection(ArrayNodeDefinition $rootNode)
  1423.     {
  1424.         $rootNode
  1425.             ->children()
  1426.                 ->arrayNode('mailer')
  1427.                     ->info('Mailer configuration')
  1428.                     ->{!class_exists(FullStack::class) && class_exists(Mailer::class) ? 'canBeDisabled' 'canBeEnabled'}()
  1429.                     ->validate()
  1430.                         ->ifTrue(function ($v) { return isset($v['dsn']) && \count($v['transports']); })
  1431.                         ->thenInvalid('"dsn" and "transports" cannot be used together.')
  1432.                     ->end()
  1433.                     ->fixXmlConfig('transport')
  1434.                     ->children()
  1435.                         ->scalarNode('message_bus')->defaultNull()->info('The message bus to use. Defaults to the default bus if the Messenger component is installed.')->end()
  1436.                         ->scalarNode('dsn')->defaultNull()->end()
  1437.                         ->arrayNode('transports')
  1438.                             ->useAttributeAsKey('name')
  1439.                             ->prototype('scalar')->end()
  1440.                         ->end()
  1441.                         ->arrayNode('envelope')
  1442.                             ->info('Mailer Envelope configuration')
  1443.                             ->children()
  1444.                                 ->scalarNode('sender')->end()
  1445.                                 ->arrayNode('recipients')
  1446.                                     ->performNoDeepMerging()
  1447.                                     ->beforeNormalization()
  1448.                                     ->ifArray()
  1449.                                         ->then(function ($v) {
  1450.                                             return array_filter(array_values($v));
  1451.                                         })
  1452.                                     ->end()
  1453.                                     ->prototype('scalar')->end()
  1454.                                 ->end()
  1455.                             ->end()
  1456.                         ->end()
  1457.                     ->end()
  1458.                 ->end()
  1459.             ->end()
  1460.         ;
  1461.     }
  1462.     private function addNotifierSection(ArrayNodeDefinition $rootNode)
  1463.     {
  1464.         $rootNode
  1465.             ->children()
  1466.                 ->arrayNode('notifier')
  1467.                     ->info('Notifier configuration')
  1468.                     ->{!class_exists(FullStack::class) && class_exists(Notifier::class) ? 'canBeDisabled' 'canBeEnabled'}()
  1469.                     ->fixXmlConfig('chatter_transport')
  1470.                     ->children()
  1471.                         ->arrayNode('chatter_transports')
  1472.                             ->useAttributeAsKey('name')
  1473.                             ->prototype('scalar')->end()
  1474.                         ->end()
  1475.                     ->end()
  1476.                     ->fixXmlConfig('texter_transport')
  1477.                     ->children()
  1478.                         ->arrayNode('texter_transports')
  1479.                             ->useAttributeAsKey('name')
  1480.                             ->prototype('scalar')->end()
  1481.                         ->end()
  1482.                     ->end()
  1483.                     ->children()
  1484.                         ->booleanNode('notification_on_failed_messages')->defaultFalse()->end()
  1485.                     ->end()
  1486.                     ->children()
  1487.                         ->arrayNode('channel_policy')
  1488.                             ->useAttributeAsKey('name')
  1489.                             ->prototype('array')
  1490.                                 ->beforeNormalization()->ifString()->then(function (string $v) { return [$v]; })->end()
  1491.                                 ->prototype('scalar')->end()
  1492.                             ->end()
  1493.                         ->end()
  1494.                     ->end()
  1495.                     ->fixXmlConfig('admin_recipient')
  1496.                     ->children()
  1497.                         ->arrayNode('admin_recipients')
  1498.                             ->prototype('array')
  1499.                                 ->children()
  1500.                                     ->scalarNode('email')->cannotBeEmpty()->end()
  1501.                                     ->scalarNode('phone')->defaultValue('')->end()
  1502.                                 ->end()
  1503.                             ->end()
  1504.                         ->end()
  1505.                     ->end()
  1506.                 ->end()
  1507.             ->end()
  1508.         ;
  1509.     }
  1510. }