Configures the options for this type.

@param OptionsResolver $resolver The resolver for the options.
429671
public function configureOptions(OptionsResolver $resolver)
    {
        $multiLanguagesChoiceManage = $this->multiLanguagesChoiceManager;
        $resolver->setDefaults(
            array(
                'multiple' => true,
                'expanded' => true,
                'required' => false,
                'class' => $this->workflowFunctionClass,
                'choice_label' => function (WorkflowFunctionInterface $choice) use ($multiLanguagesChoiceManage) {
                    return $multiLanguagesChoiceManage->choose($choice->getNames());
                },
            )
        );
    }
938334
public function configureOptions(OptionsResolver $resolver)
    {
        // user can defined an admin name
        $resolver
            ->setDefault('admin', null)
            ->setDefault('action', null)
            ->setDefault('route', null)
            ->setDefault('url', null)
            ->setDefault('parameters', [])
            ->setDefault('text', '')
            ->setDefault('attr', [])
            ->setDefault('link_attr', [
                'class' => 'nav-link',
            ])
            ->setDefault('items', [])
            ->setDefault('icon', null)
            ->setDefault('link_css_class', 'nav-link')
            ->setNormalizer('admin', function(Options $options, $adminName) {
                // user has to defined either an admin name and an action name, or a route name with optional
                // parameters, or an url
                if (null === $adminName
                    && null === $options->offsetGet('route')
                    && null === $options->offsetGet('url')
                ) {
                    throw new InvalidOptionsException(
                        'You should either defined an admin name, or route name or an uri'
                    );
                }

                return $adminName;
            })
            // if an admin name is set, an action name can provided. This action will be the menu link
            ->setNormalizer('action', function(Options $options, $action) {
                // if an action name is provided, an admin name should be defined too
                if (null !== $action && null === $options->offsetGet('admin')) {
                    throw new InvalidOptionsException(
                        'You should provide an admin name for this action '.$action
                    );
                }

                // default to list action
                if (null !== $options->offsetGet('admin') && null === $action) {
                    $action = 'list';
                }

                return $action;
            })
            ->setAllowedTypes('parameters', 'array')
            ->setNormalizer('attr', function(Options $options, $attr) {
                if (!is_array($attr)) {
                    $attr = [];
                }

                if (empty($attr['id'])) {
                    $attr['id'] = uniqid('admin-menu-');
                }

                if ('horizontal' === $this->position && !key_exists('class', $attr)) {
                    $attr['class'] = 'nav-item';
                }

                return $attr;
            })
            ->setNormalizer('link_attr', function(Options $options, $value) {
                if (!is_array($value)) {
                    $value = [];
                }

                if (!key_exists('class', $value)) {
                    $value['class'] = 'nav-link';
                }

                return $value;
            })
            ->setNormalizer('items', function(Options $options, $items) {
                if (!is_array($items)) {
                    $items = [];
                }
                $resolver = new OptionsResolver();
                $resolvedItems = [];

                foreach ($items as $name => $item) {
                    $itemConfiguration = new MenuItemConfiguration($name, $this->position);
                    $itemConfiguration->configureOptions($resolver);
                    $itemConfiguration->setParameters($resolver->resolve($item));

                    $resolvedItems[$name] = $itemConfiguration;
                }

                return $resolvedItems;
            })
            ->setNormalizer('text', function(Options $options, $text) {
                if (!$text) {
                    // TODO use translation pattern key instead
                    $text = ucfirst($this->name);
                }

                return $text;
            })
        ;
    }
1354065
protected function configureOptions(OptionsResolver $resolver): void
    {
        // We set object properties' _default_ values to null to ensure we do not create unnecessary objects.
        $resolver->setDefaults([
            static::CONFIG_USER_AGENT_PREFIX => null,
            static::CONFIG_HTTP_CLIENT_BUILDER => null,
            static::CONFIG_JOURNAL => null,
            static::CONFIG_URI_FACTORY => null,
            static::CONFIG_REQUEST_FACTORY => null,
            static::CONFIG_ERROR_FORMATTER => null,
            static::CONFIG_RETRY_PLUGIN_CONFIG => null,
        ]);
        $resolver->setAllowedTypes(static::CONFIG_USER_AGENT_PREFIX, ['null', 'string']);
        $resolver->setAllowedTypes(static::CONFIG_HTTP_CLIENT_BUILDER, ['null', '\Apigee\Edge\HttpClient\Utility\BuilderInterface']);
        $resolver->setAllowedTypes(static::CONFIG_JOURNAL, ['null', '\Apigee\Edge\HttpClient\Utility\JournalInterface']);
        $resolver->setAllowedTypes(static::CONFIG_URI_FACTORY, ['null', '\Http\Message\UriFactory']);
        $resolver->setAllowedTypes(static::CONFIG_REQUEST_FACTORY, ['null', '\Http\Message\RequestFactory']);
        $resolver->setAllowedTypes(static::CONFIG_ERROR_FORMATTER, ['null', '\Http\Message\Formatter']);
        $resolver->setAllowedTypes(static::CONFIG_RETRY_PLUGIN_CONFIG, ['null', 'array']);
    }
1041234
protected function resolveOptions(array $options = [], callable $optionsConfigurator): array
    {
        $resolver = new OptionsResolver();
        call_user_func_array($optionsConfigurator, [$resolver]);

        return $resolver->resolve($options);
    }
641517
public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(
            array(
                'type'         => 'oo_workflow_profile_transitions',
                'allow_add'    => false,
                'allow_delete' => false,
                'options'      => array(
                    'statuses' => $this->statuses,
                    'locale'       => $this->locale
                )
            )
        );
    }
942351
private function configureStdoutLogProperties(OptionsResolver $resolver)
    {
        $resolver
            ->setDefined('stdout_logfile')
            ->setAllowedTypes('stdout_logfile', 'string');

        $resolver->setDefined('stdout_logfile_maxbytes');
        $this->configureByteProperty('stdout_logfile_maxbytes', $resolver);

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

        $resolver->setDefined('stdout_capture_maxbytes');
        $this->configureByteProperty('stdout_capture_maxbytes', $resolver);

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

        $resolver->setDefined('stdout_syslog')
            ->setAllowedTypes('stdout_syslog', 'bool');
    }
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');
    }
929054
public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $defaults = array(
            'tpl' => 'slider.value.min: __value_1__ slider.value.max: __value_2__',
            'min' => 0,
            'max' => 100,
            'orientation' => 'horizontal',
            'width' => '300px',
            'height' => '300px',
       );
    
        $resolver->setDefaults(array(
            'first_name' => 'first_slider',
            'second_name' => 'second_slider',
            'translation_domain' => 'ThraceFormBundle',
            'configs' => $defaults,
        ));
    
        $resolver->setNormalizers(array(
            'configs' => function (Options $options, $value) use ($defaults) {
                $value = array_replace_recursive($defaults, $value);
                
                if($value['orientation'] == 'horizontal'){
                    unset($value['height']);
                } else {
                    unset($value['width']);
                }
                
                $value['first_name'] = $options->get('first_name');
                $value['second_name'] = $options->get('second_name');
                $value['range'] = true;

                return $value;
            }
        ));
    }
573364
private function configureStartControlProperties(OptionsResolver $resolver)
    {
        $resolver->setDefined('autostart');
        $this->configureBooleanProperty('autostart', $resolver);


        $resolver
            ->setDefined('autorestart')
            ->setAllowedTypes('autorestart', ['bool', 'string'])
            ->setAllowedValues('autorestart', [true, false, 'true', 'false', 'unexpected'])
            ->setNormalizer('autorestart', function (Options $options, $value) {
                return (is_bool($value) or $value === 'unexpected') ? $value : ($value === 'true' ? true : false);
            });

        $resolver->setDefined('startsecs');
        $this->configureIntegerProperty('startsecs', $resolver);

        $resolver->setDefined('startretries');
        $this->configureIntegerProperty('startretries', $resolver);
    }
686187
public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefault('synapse_form_options', array());

        $resolver->setDefined(array('synapse_theme'));
        $resolver->setNormalizer('synapse_theme', function (Options $options, $value) {
            switch (true) {
                case empty($value):
                    return $value;

                case $value instanceof Theme:
                    return $value;

                default:
                    if (!$theme = $this->themeLoader->retrieveByName($value)) {
                        throw new InvalidThemeException(sprintf(
                            'Theme "%s" not registered. Only %s are, check your configuration.',
                            $value,
                            $this->themeLoader->retrieveAll()->display('name')
                        ));
                    }

                    return $theme;
            }
        });
    }
345135
protected function setResolverOptions($options)
    {
        $resolver = $this->resolver();
        $resolver->with($resolver::parseWith($options));
    }
1320177
protected function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setRequired('content');
        $resolver->setAllowedTypes('content', SiteContent::class);

        $resolver->setDefined('exclude_self');
        $resolver->setAllowedTypes('exclude_self', ['bool']);
        $resolver->setDefaults([
            'exclude_self' => true,
        ]);
    }
555747
protected function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setRequired([
            'content',
            'relation_field',
        ]);

        $resolver->setAllowedTypes('content', SiteContent::class);
        $resolver->setAllowedTypes('relation_field', ['string', 'array']);
        $resolver->setAllowedValues(
            'relation_field',
            function ($fields) {
                if (!is_array($fields)) {
                    return true;
                }

                foreach ($fields as $field) {
                    if (!is_string($field)) {
                        return false;
                    }
                }

                return true;
            }
        );

        $resolver->setDefined('exclude_self');
        $resolver->setAllowedTypes('exclude_self', ['bool']);
        $resolver->setDefaults([
            'exclude_self' => true,
        ]);
    }
1045568
public function configureOptions(OptionsResolver $resolver)
    {
        $registry = $this->registry;

        $entityManagerNormalizer = function (Options $options, $entityManager) use ($registry) {
            if (null !== $entityManager) {
                if ($entityManager instanceof ObjectManager) {
                    return $entityManager;
                }

                return $registry->getManager($entityManager);
            }

            $entityManager = $registry->getManagerForClass($options['class']);

            if (null === $entityManager) {
                throw new RuntimeException(sprintf(
                    'Class "%s" seems not to be a managed Doctrine entity. Did you forget to map it?',
                    $options['class']
                ));
            }

            return $entityManager;
        };

        $compoundNormalizer = function () {
            return false;
        };

        $resolver->setDefaults([
            'entity_manager' => null,
        ]);

        $resolver->setRequired([
            'class',
        ]);

        $resolver->setNormalizer('entity_manager', $entityManagerNormalizer);
        $resolver->setNormalizer('compound', $compoundNormalizer);

        $resolver->setAllowedTypes('entity_manager', [
            'null',
            'string',
            ObjectManager::class,
        ]);
    }
572858
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');
        $this->configureIntegerProperty('stopwaitsecs', $resolver);

        $resolver->setDefined('stopasgroup');
        $this->configureBooleanProperty('stopasgroup', $resolver);

        $resolver->setDefined('killasgroup');
        $this->configureBooleanProperty('killasgroup', $resolver);
    }
941627
public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(
            [
                'empty_data' => null,
                'data_class' => null,
                'attributes_config' => null,
                'merge_attributes_config' => false,
                'attribute' => null,
                'family' => null,
                'fieldset_options' => [],
            ]
        );
        $resolver->setAllowedTypes('attributes_config', ['NULL', 'array']);
        $resolver->setAllowedTypes('merge_attributes_config', ['bool']);
        $resolver->setAllowedTypes('attribute', ['NULL', AttributeInterface::class]);
        $resolver->setAllowedTypes('family', ['NULL', 'string', FamilyInterface::class]);
        $resolver->setAllowedTypes('fieldset_options', ['array']);

        $resolver->setNormalizer(
            'family',
            function (Options $options, $value) {
                // If family option is not set, try to fetch the family from the attribute option
                if (null === $value) {
                    /** @var AttributeInterface $attribute */
                    $attribute = $options['attribute'];
                    if (!$attribute) {
                        throw new MissingOptionsException(
                            "An option is missing: you must set either the 'family' option or the 'attribute' option"
                        );
                    }
                    $allowedFamilies = $attribute->getOption('allowed_families', []);
                    if (1 !== \count($allowedFamilies)) {
                        $m = "Can't automatically compute the 'family' option with an attribute with no family allowed";
                        $m .= " or multiple allowed families, please set the 'family' option manually";
                        throw new MissingOptionsException($m);
                    }

                    $value = reset($allowedFamilies);
                }

                if ($value instanceof FamilyInterface) {
                    return $value;
                }

                return $this->familyRegistry->getFamily($value);
            }
        );
        $resolver->setNormalizer(
            'empty_data',
            function (Options $options, $value) {
                if (null !== $value) {
                    return $value;
                }
                /** @var FamilyInterface $family */
                $family = $options['family'];

                if ($family->isSingleton()) {
                    /** @var DataRepository $repository */
                    $repository = $this->repositoryFinder->getRepository($family->getDataClass());

                    return $repository->getInstance($family);
                }

                return $family->createData();
            }
        );
        $resolver->setNormalizer(
            'data_class',
            function (Options $options, $value) {
                if (null !== $value) {
                    $m = "DataType form does not supports the 'data_class' option, it will be automatically resolved";
                    $m .= ' with the family';
                    throw new \UnexpectedValueException($m);
                }
                /** @var FamilyInterface $family */
                $family = $options['family'];

                return $family->getDataClass();
            }
        );
    }
416607
public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setRequired(
            [
                'admin_action',
            ]
        );
        $resolver->setAllowedTypes('admin_action', ['string', Action::class]);
        $resolver->setDefaults(
            [
                'admin' => null,
            ]
        );
        $resolver->setAllowedTypes('admin', ['NULL', 'string', Admin::class]);
        $resolver->setNormalizer(
            'admin',
            function (Options $options, $value) {
                if ($value instanceof Admin) {
                    return $value;
                }
                if (null === $value) {
                    return $this->adminRegistry->getCurrentAdmin();
                }

                return $this->adminRegistry->getAdmin($value);
            }
        );
        $resolver->setNormalizer(
            'admin_action',
            function (Options $options, $value) {
                /** @var Admin $admin */
                $admin = $options['admin'];

                if ($value instanceof Action) {
                    if ($value->getAdmin() !== $admin) {
                        throw new \LogicException(
                            "Wrong Admin for Action {$value->getCode()}: {$value->getAdmin()->getCode()}"
                        );
                    }

                    return $value;
                }

                return $admin->getAction($value);
            }
        );
        $resolver->setNormalizer(
            'uri',
            function (Options $options, $value) {
                if (null === $value) {
                    return $this->adminRouter->generateAdminPath(
                        $options['admin'],
                        $options['admin_action']->getCode(),
                        $options['route_parameters']
                    );
                }

                return $value;
            }
        );
    }