Proxy Helper Options For Resolver
@param $options
345135
protected function setResolverOptions($options)
    {
        $resolver = $this->resolver();
        $resolver->with($resolver::parseWith($options));
    }
546379
public function configureOptionsResolver(OptionsResolver $resolver)
    {
        parent::configureOptionsResolver($resolver);

        $resolver->setRequired([
            self::OPTION_SERVICE,
            self::OPTION_METHOD,
        ]);

        $resolver->setAllowedTypes(self::OPTION_SERVICE, ['string']);
        $resolver->setAllowedTypes(self::OPTION_METHOD, ['string']);
    }
622545
protected function resolveOptions(array $options)
    {
        if (null === $this->resolver) {
            $this->resolver = new OptionsResolver();
            $this->resolver->setDefaults(
                array(
                    'second_class' => 'CalendR\Period\Second',
                    'minute_class' => 'CalendR\Period\Minute',
                    'hour_class' => 'CalendR\Period\Hour',
                    'day_class' => 'CalendR\Period\Day',
                    'week_class' => 'CalendR\Period\Week',
                    'month_class' => 'CalendR\Period\Month',
                    'year_class' => 'CalendR\Period\Year',
                    'range_class' => 'CalendR\Period\Range',
                    'first_weekday' => Day::MONDAY,
                )
            );
            $this->setDefaultOptions($this->resolver);
        }

        return $this->resolver->resolve($options);
    }
383068
protected function resolveCommandOptions(array $options)
    {
        $resolver = new OptionsResolver();

        $resolver
            ->setDefined([
                'description',
                'usage',
                'aliases',
            ])
            ->setDefaults([
                'description' => 'No description provided.',
                'usage'       => '',
                'aliases'     => [],
            ]);

        $options = $resolver->resolve($options);

        if (! empty($options['usage'])) {
            $options['usage'] .= ' ';
        }

        return $options;
    }
414801
private function resolveConfiguration(array $options = []): void
    {
        $resolver = new OptionsResolver();
        $this->configureOptions($resolver);
        $options = $resolver->resolve($options);
        $this->userAgentPrefix = $options[static::CONFIG_USER_AGENT_PREFIX];
        $this->httpClientBuilder = $options[static::CONFIG_HTTP_CLIENT_BUILDER] ?: new Builder();
        $this->uriFactory = $options[static::CONFIG_URI_FACTORY] ?: UriFactoryDiscovery::find();
        $this->requestFactory = $options[static::CONFIG_REQUEST_FACTORY] ?: MessageFactoryDiscovery::find();
        $this->journal = $options[static::CONFIG_JOURNAL] ?: new Journal();
        $this->errorFormatter = $options[static::CONFIG_ERROR_FORMATTER];
        $this->retryPluginConfig = $options[static::CONFIG_RETRY_PLUGIN_CONFIG];
    }
1129348
public function configureOptions(OptionsResolver $resolver)
    {
        $resolver
            ->setDefaults([
                // enable or disable extra configuration listener
                'enable_extra_configuration' => true,
                'enable_security' => true,
                'enable_menus' => true,
                'enable_homepage' => true,
                'translation' => false,
                'translation_pattern' => false,
                'title' => 'AdminBundle application',
                'description' => '',
                'locale' => 'en',
                // Main base template as bundles are not loaded when reading the configuration, the kernel
                // locateResources will always failed. So we must not check resource existence here.
                'base_template' => '@LAGAdmin/base.html.twig',
                'block_template' => '@LAGAdmin/Form/fields.html.twig',
                'menu_template' => '@LAGAdmin/Menu/menu.html.twig',
                'list_template' => '@LAGAdmin/CRUD/list.html.twig',
                'edit_template' => '@LAGAdmin/CRUD/edit.html.twig',
                'create_template' => '@LAGAdmin/CRUD/create.html.twig',
                'delete_template' => '@LAGAdmin/CRUD/delete.html.twig',
                'homepage_template' => '@LAGAdmin/Pages/home.html.twig',
                'homepage_route' => 'lag.admin.homepage',
                'routing_url_pattern' => '/{admin}/{action}',
                'routing_name_pattern' => 'lag.admin.{admin}.{action}',
                'bootstrap' => true,
                'date_format' => 'Y/m/d',
                'pager' => 'pagerfanta',
                // string length before truncation (0 means no truncation)
                'string_length' => 200,
                'string_length_truncate' => '...',
                'max_per_page' => 20,
                'admin_class' => Admin::class,
                'action_class' => Action::class,
                'permissions' => 'ROLE_ADMIN',
                'page_parameter' => 'page',
            ])
            ->setAllowedTypes('enable_extra_configuration', 'boolean')
            ->setAllowedTypes('enable_security', 'boolean')
            ->setAllowedTypes('enable_menus', 'boolean')
            ->setAllowedTypes('title', 'string')
            ->setAllowedTypes('description', 'string')
            ->setAllowedTypes('locale', 'string')
            ->setAllowedTypes('base_template', 'string')
            ->setAllowedTypes('block_template', 'string')
            ->setAllowedTypes('bootstrap', 'boolean')
            ->setAllowedTypes('date_format', 'string')
            ->setAllowedTypes('string_length', 'integer')
            ->setAllowedTypes('string_length_truncate', 'string')
            ->setAllowedTypes('max_per_page', 'integer')
            ->setAllowedTypes('admin_class', 'string')
            ->setAllowedTypes('routing_name_pattern', 'string')
            ->setAllowedTypes('routing_url_pattern', 'string')
            ->setAllowedTypes('page_parameter', 'string')
            ->setNormalizer('routing_name_pattern', function(Options $options, $value) {
                if (false === strstr($value, '{admin}')) {
                    throw new InvalidOptionsException(
                        'Admin routing configuration pattern name should contains the {admin} placeholder'
                    );
                }
                if (false === strstr($value, '{action}')) {
                    throw new InvalidOptionsException(
                        'Admin routing configuration pattern name should contains the {action} placeholder'
                    );
                }

                return $value;
            })
            ->setNormalizer('routing_url_pattern', function(Options $options, $value) {
                if (false === strstr($value, '{admin}')) {
                    throw new InvalidOptionsException('Admin routing configuration url pattern should contains {admin} placeholder');
                }

                if (false === strstr($value, '{action}')) {
                    throw new InvalidOptionsException('Admin routing configuration url pattern should contains the {action} placeholder');
                }

                return $value;
            })
        ;
        // admin field type mapping
        $this->setFieldsOptions($resolver);
    }
1264188
protected function handleOptions(array &$options = [])
    {
        parent::handleOptions($options);
        if (isset($options['reason_phrase'])) {
            $this->reasonPhrase = $options['reason_phrase'];
        }
    }
1067662
protected function resolveCommandClientOptions(array $options)
    {
        $resolver = new OptionsResolver();

        $resolver
            ->setRequired('token')
            ->setAllowedTypes('token', 'string')
            ->setDefined([
                'token',
                'prefix',
                'name',
                'description',
                'defaultHelpCommand',
                'discordOptions',
            ])
            ->setDefaults([
                'prefix'             => '@mention ',
                'name'               => '<UsernamePlaceholder>',
                'description'        => 'A bot made with DiscordPHP.',
                'defaultHelpCommand' => true,
                'discordOptions'     => [],
            ]);

        return $resolver->resolve($options);
    }
281492
protected function configureLogOptions(array $options = [])
    {
        $resolver = new OptionsResolver();

        $resolver->setDefaults([
            'enabled'    => false,
            'level'      => LogLevel::DEBUG,
            'handler'    => null,
            'subscriber' => null,
            'path'       => sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php-tmdb-api.log',
        ]);

        $resolver->setRequired([
            'enabled',
            'level',
            'handler',
        ]);

        $resolver->setAllowedTypes('enabled', ['bool']);
        $resolver->setAllowedTypes('level', ['string']);
        $resolver->setAllowedTypes('handler', ['object', 'null']);
        $resolver->setAllowedTypes('path', ['string', 'null']);
        $resolver->setAllowedTypes('subscriber', ['object', 'null']);

        $options = $resolver->resolve(array_key_exists('log', $options) ? $options['log'] : []);

        if ($options['enabled'] && !$options['handler']) {
            $options['handler'] = new StreamHandler(
                $options['path'],
                $options['level']
            );
        }

        return $options;
    }
852758
protected function processOptions(array $options)
    {
        $resolver = new OptionsResolver();
        $this->setDefaultOptions($resolver);

        return $resolver->resolve($options);
    }
777372
public function configureOptionsResolver(OptionsResolver $resolver)
    {
        parent::configureOptionsResolver($resolver);
        $resolver->setDefaults([
            self::OPTION_TTL => $this->defaultTTL,
            self::OPTION_PERSISTENT => $this->defaultPersistence,
            self::OPTION_PRIORITY => 4,
            self::OPTION_EXCHANGE_PATTERN => self::EXCHANGE_PATTERN_IN_ONLY,
            self::OPTION_TRACK => true,
            self::OPTION_PREFIX => '',
        ]);

        $resolver->setRequired([
            self::OPTION_TTL, self::OPTION_PERSISTENT, self::OPTION_PRIORITY, self::OPTION_PREFIX,
            self::OPTION_QUEUE_DRIVER, self::OPTION_QUEUE_NAME,
        ]);

        $resolver->setAllowedTypes(self::OPTION_TTL, ['numeric']);
        $resolver->setAllowedValues(self::OPTION_PERSISTENT, [true, false, 'true', 'false', 0, 1, '0', '1']);
        $resolver->setAllowedTypes(self::OPTION_PERSISTENT, ['numeric', 'string', 'boolean']);
        $resolver->setAllowedTypes(self::OPTION_PRIORITY, ['numeric']);
        $resolver->setAllowedTypes(self::OPTION_PREFIX, ['string']);
        $resolver->setAllowedTypes(self::OPTION_QUEUE_DRIVER, ['string']);
    }
1191519
protected function handleOptions(&$options) {
		if (is_array($options) && isset($options[self::PARAM_PROFILER])) {
			$this->setProfilerStatus($options[self::PARAM_PROFILER]);
			
			unset($options[self::PARAM_PROFILER]);
		}
	}
645451
private static function createRedirectResolver(array $options, string $host, ?array $proxy, array $noProxy, array &$info, ?\Closure $onProgress): \Closure
    {
        $redirectHeaders = [];
        if (0 < $maxRedirects = $options['max_redirects']) {
            $redirectHeaders = ['host' => $host];
            $redirectHeaders['with_auth'] = $redirectHeaders['no_auth'] = array_filter($options['request_headers'], static function ($h) {
                return 0 !== stripos($h, 'Host:');
            });

            if (isset($options['headers']['authorization']) || isset($options['headers']['cookie'])) {
                $redirectHeaders['no_auth'] = array_filter($options['request_headers'], static function ($h) {
                    return 0 !== stripos($h, 'Authorization:') && 0 !== stripos($h, 'Cookie:');
                });
            }
        }

        return static function (NativeClientState $multi, ?string $location, $context) use ($redirectHeaders, $proxy, $noProxy, &$info, $maxRedirects, $onProgress): ?string {
            if (null === $location || $info['http_code'] < 300 || 400 <= $info['http_code']) {
                $info['redirect_url'] = null;

                return null;
            }

            $url = self::resolveUrl(self::parseUrl($location), $info['url']);
            $info['redirect_url'] = implode('', $url);

            if ($info['redirect_count'] >= $maxRedirects) {
                return null;
            }

            $now = microtime(true);
            $info['url'] = $url;
            ++$info['redirect_count'];
            $info['redirect_time'] = $now - $info['start_time'];

            // Do like curl and browsers: turn POST to GET on 301, 302 and 303
            if (\in_array($info['http_code'], [301, 302, 303], true)) {
                $options = stream_context_get_options($context)['http'];

                if ('POST' === $options['method'] || 303 === $info['http_code']) {
                    $info['http_method'] = $options['method'] = 'HEAD' === $options['method'] ? 'HEAD' : 'GET';
                    $options['content'] = '';
                    $options['header'] = array_filter($options['header'], static function ($h) {
                        return 0 !== stripos($h, 'Content-Length:') && 0 !== stripos($h, 'Content-Type:');
                    });

                    stream_context_set_option($context, ['http' => $options]);
                }
            }

            [$host, $port, $url['authority']] = self::dnsResolve($url, $multi, $info, $onProgress);
            stream_context_set_option($context, 'ssl', 'peer_name', $host);

            if (false !== (parse_url($location, PHP_URL_HOST) ?? false)) {
                // Authorization and Cookie headers MUST NOT follow except for the initial host name
                $requestHeaders = $redirectHeaders['host'] === $host ? $redirectHeaders['with_auth'] : $redirectHeaders['no_auth'];
                $requestHeaders[] = 'host: '.$host.$port;
                self::configureHeadersAndProxy($context, $host, $requestHeaders, $proxy, $noProxy);
            }

            return implode('', $url);
        };
    }
1067943
private function getResolver()
    {
        if ($this->resolver === null) {
            $this->resolver = new OptionsResolver();
            $this->configureOptions($this->resolver);
        }

        return $this->resolver;
    }
480590
private function configureStopControlProperties(OptionsResolver $resolver)
    {
        $resolver->setDefined('exitcodes');
        $this->configureArrayProperty('exitcodes', $resolver);

        $resolver
            ->setDefined('stopsignal')
            ->setAllowedTypes('stopsignal', 'string')
            ->setAllowedValues('stopsignal', ['TERM', 'HUP', 'INT', 'QUIT', 'KILL', 'USR1', 'USR2']);

        $resolver->setDefined('stopwaitsecs')
            ->setAllowedTypes('stopwaitsecs', 'int');

        $resolver->setDefined('stopasgroup')
            ->setAllowedTypes('stopasgroup', 'bool');

        $resolver->setDefined('killasgroup')
            ->setAllowedTypes('killasgroup', 'bool');
    }
140055
protected function fillOptions($options): void
    {
        $this->uri = $options['uri'] ?? '/';
        $this->namespace = $options['namespace'] ?? config('jsonrpc.controllerNamespace', 'App\\Http\\Controllers\\Api\\');
        $this->postfix = $options['postfix'] ?? config('jsonrpc.controllerPostfix', 'Controller');
        $this->description = $options['description'] ?? config('jsonrpc.description', 'JsonRpc Server');
        $this->controller = $options['controller'] ?? config('jsonrpc.defaultController', 'Api');
        $this->middleware = $options['middleware'] ?? config('jsonrpc.middleware', [MethodClosureMiddleware::class]);
        $this->acl = $options['acl'] ?? config('jsonrpc.acl', []);
        $this->auth = $options['auth'] ?? config('jsonrpc.authValidate', true);
        $this->handlers = $options['handlers'] ?? config('jsonrpc.handlers', self::DEFAULT_HANDLERS);
        $this->endpoint = $options['endpoint'] ?? null;
        $this->action = $options['action'] ?? null;
    }
927257
protected function configureOptions(OptionsResolver $resolver)
    {
        parent::configureOptions($resolver);
        $resolver->setDefaults(
            [
                'allow_reset' => false,   // Allow the reader to reset it's iterator
                'log_count' => false,   // Log in state history the result count
                'empty_log_level' => LogLevel::WARNING,
            ]
        );
        $resolver->setAllowedValues(
            'empty_log_level',
            [
                LogLevel::ALERT,
                LogLevel::CRITICAL,
                LogLevel::DEBUG,
                LogLevel::EMERGENCY,
                LogLevel::ERROR,
                LogLevel::INFO,
                LogLevel::NOTICE,
                LogLevel::WARNING,
            ]
        );
    }