(non-PHPdoc)
@see \Thrace\DataGridBundle\DataGrid\DataGridHandlerInterface::resolveOptions()
494128
public function resolveOptions(array $options)
    {
        $resolver = new OptionsResolver();
    
        $resolver->setRequired(array(
            'search', 'filters', 'page', 'orderBy', 'sort', 'records', 'masterGridRowId'
        ));
    
        $resolver->setAllowedTypes(array(
            'page' => array('int'),
            'orderBy' => array('string', 'bool'),
            'sort' => array('string'),
            'records' => array('int'),
            'search' => array('bool'),
            'filters' => array('array', 'bool'),
            'masterGridRowId' => array('int')
        ));
    
        $resolver->setAllowedValues(array(
            'sort' => array('ASC', 'DESC')
        ));
    
        $resolver->setDefaults(array(
            'search'          => false,
            'filters'         => false,
            'page'            => 0,
            'orderBy'         => false,
            'sort'            => 'ASC',
            'records'         => 0,
            'masterGridRowId' => 0
        ));
    
        $this->options = $resolver->resolve($options);
        
        return $this;
    }
947250
private function getOptionsResolver()
    {
        // TODO Use/Merge ConfigurationBuilder options resolver.
        if (!$this->optionsResolver) {
            $resolver = new OptionsResolver();

            $resolver
                ->setRequired(['namespace', 'id', 'classes'])
                ->setDefaults([
                    'name'        => function (Options $options) {
                        return Inflector::camelize($options['id']);
                    },
                    'parent_id'   => null,
                    'event'       => null,
                    'templates'   => null,
                    'translation' => null,
                ])
                ->setAllowedTypes('namespace', 'string')
                ->setAllowedTypes('id', 'string')
                ->setAllowedTypes('name', 'string')
                ->setAllowedTypes('parent_id', ['null', 'string'])
                ->setAllowedTypes('classes', 'array')
                ->setAllowedTypes('event', ['null', 'string', 'array'])
                ->setAllowedTypes('templates', ['null', 'string', 'array'])
                ->setAllowedTypes('translation', ['null', 'array']);


            // Classes option
            $classesResolver = new OptionsResolver();
            $classesResolver
                ->setRequired(['entity'])
                ->setDefaults([
                    'form_type'  => null, // @TODO/WARNING no longer required (behavior refactoring)
                    'repository' => null,
                ])
                ->setAllowedTypes('entity', 'string')
                ->setAllowedTypes('repository', ['null', 'string'])
                ->setAllowedTypes('form_type', ['null', 'string']); // @TODO/WARNING no longer required (behavior refactoring)

            $resolver
                ->setNormalizer('classes', function (Options $options, $value) use ($classesResolver) {
                    foreach ($value as $class) {
                        if ($class && !class_exists($class)) {
                            throw new InvalidOptionsException(sprintf("Class '%s' does not exists.", $class));
                        }
                    }

                    $entity = $value['entity'];
                    if (null !== $options['translation'] && !is_subclass_of($entity, TranslatableInterface::class)) {
                        throw new InvalidOptionsException(sprintf(
                            "Class '%s' must implements '%s'.",
                            $entity,
                            TranslatableInterface::class));
                    }

                    $repository = array_key_exists('repository', $value) ? $value['repository'] : null;
                    if (null === $repository) {
                        $value['repository'] = null !== $options['translation']
                            ? TranslatableResourceRepository::class
                            : ResourceRepository::class;
                    } elseif (null !== $options['translation']) {
                        if (!is_subclass_of($repository, TranslatableResourceRepositoryInterface::class)) {
                            throw new InvalidOptionsException(sprintf(
                                "Class '%s' must implements '%s'.",
                                $repository,
                                TranslatableResourceRepositoryInterface::class
                            ));
                        }
                    } else {
                        if (!is_subclass_of($repository, ResourceRepositoryInterface::class)) {
                            throw new InvalidOptionsException(sprintf(
                                "Class '%s' must implements '%s'.",
                                $repository,
                                ResourceRepositoryInterface::class
                            ));
                        }
                    }

                    return $classesResolver->resolve($value);
                });


            // Translation option
            $translationResolver = new OptionsResolver();
            $translationResolver
                ->setRequired(['entity', 'fields'])
                ->setDefault('repository', null)
                ->setAllowedTypes('entity', 'string')
                ->setAllowedTypes('fields', 'array')
                ->setAllowedTypes('repository', ['null', 'string'])
                ->setAllowedValues('entity', function ($class) {
                    if (!class_exists($class)) {
                        throw new InvalidOptionsException(sprintf("Class '%s' does not exists.", $class));
                    }
                    if (!is_subclass_of($class, TranslationInterface::class)) {
                        throw new InvalidOptionsException(sprintf("Class '%s' must implements '%s'.", $class, TranslationInterface::class));
                    }

                    return true;
                })
                ->setAllowedValues('fields', function ($fields) {
                    if (empty($fields)) {
                        throw new InvalidOptionsException("Translatable fields cannot be empty.");
                    }

                    return true;
                })
                ->setAllowedValues('repository', function ($class) {
                    if (null !== $class && !class_exists($class)) {
                        throw new InvalidOptionsException(sprintf("Class '%s' does not exists.", $class));
                    }

                    return true;
                });

            /** @noinspection PhpUnusedParameterInspection */
            $resolver->setNormalizer('translation', function (Options $options, $value) use ($translationResolver) {
                if (is_array($value)) {
                    return $translationResolver->resolve($value);
                }

                return $value;
            });


            // Event option
            $eventResolver = new OptionsResolver();
            $eventResolver
                ->setRequired(['class'])
                ->setDefaults([
                    'class'    => $this->defaultEventClass,
                    'priority' => 0,
                ])
                ->setAllowedTypes('class', 'string')
                ->setAllowedTypes('priority', 'int');

            /** @noinspection PhpUnusedParameterInspection */
            $resolver->setNormalizer('event', function (Options $options, $value) use ($eventResolver) {
                if (is_string($value)) {
                    $value = ['class' => $value];
                }

                $value = $eventResolver->resolve((array)$value);

                if (!is_subclass_of($value['class'], ResourceEventInterface::class)) {
                    throw new InvalidOptionsException(sprintf(
                        "Class '%s' must implements '%s'.",
                        $value['class'],
                        ResourceEventInterface::class
                    ));
                }

                return $value;
            });


            // Templates option
            /** @noinspection PhpUnusedParameterInspection */
            $resolver->setNormalizer('templates', function (Options $options, $value) {
                return $this->buildTemplateList($value);
            });


            $this->optionsResolver = $resolver;
        }

        return $this->optionsResolver;
    }
407210
protected function resolveFieldOptionValues(array $options)
    {
        foreach ($options as &$value) {
            if (!is_array($value)) {
                continue;
            }
            if (is_callable($value)) {
                $value = $value();

                continue;
            }

            $value = $this->resolveFieldOptionValues($value);
        }

        unset($value);

        return $options;
    }
1079078
protected function getResolvedOptions(array $options)
    {
        $resolver = new OptionsResolver();
        $resolver->setDefaults(array(
                'processClass' => 'Symfony\\Component\\Process\\Process',
            ))
            ->setRequired(array('folder'))
            ->setAllowedTypes(array(
                'processClass' => 'string',
                'folder' => 'string',
            ))
        ;

        return $resolver->resolve($options);
    }
506109
function resolve (options) {
  return {
    apiBuilders: resolveOption(options, 'apiBuilders'),
    languages: resolveOption(options, 'languages'),
    targetVersions: resolveOption(options, 'targetVersions'),
    issueUrl: resolveOption(options, 'issueUrl'),
    processChangelogs: resolveOption(options, 'processChangelogs'),
    changelogReverseVisibleList: resolveOption(options, 'changelogReverseVisibleList'),
    changelogGroupByApi: resolveOption(options, 'changelogGroupByApi')
  }
}
416932
private function resolveOptions(array $options = array())
    {
        $this->options["ga"] = $this->ga;

        if (!$this->ga->getCode() && isset($options['code'])) {
            $this->ga->setCode($options['code']);
        } else if (!$this->ga->getDomain() && isset($options['domain'])) {
            $this->ga->setDomain($options['domain']);
        }

        return array_merge($this->options, $options);
    }
1083875
protected function resolveOptions(array $config): array
    {
        $optionsResolver = new OptionsResolver();

        $optionsResolver->setDefault('name', null);
        $optionsResolver->setDefault('type', null);
        $optionsResolver->setDefault('options', []);
        $optionsResolver->setDefault('parent', null);

        $optionsResolver->setRequired(['name', 'type', 'options', 'parent']);

        $optionsResolver->setAllowedTypes('name', ['null', 'string']);
        $optionsResolver->setAllowedTypes('type', ['null', 'string', ParameterTypeInterface::class]);
        $optionsResolver->setAllowedTypes('options', 'array');
        $optionsResolver->setAllowedTypes('parent', ['null', ParameterBuilderInterface::class]);

        $optionsResolver->setNormalizer(
            'type',
            function (Options $options, $value) {
                if (!is_string($value)) {
                    return $value;
                }

                return $this->parameterTypeRegistry->getParameterTypeByClass($value);
            }
        );

        return $optionsResolver->resolve($config);
    }
375932
private function resolveOptions(array $options = array())
    {
        $this->options["seo"] = $this->seo;

        if (!$this->seo->getTitle() && $options['defaultTitle']) {
            $this->seo->setTitle($options['defaultTitle']);
        }

        if (!$this->seo->getTitle() && $options['defaultKeywords']) {
            $this->seo->setTitle($options['defaultKeywords']);
        }

        if (!$this->seo->getTitle() && $options['defaultDescription']) {
            $this->seo->setTitle($options['defaultDescription']);
        }

        return array_merge($this->options, $options);
    }
156022
public function resolveOptions(MetadataType $type)
    {
        return $this->getResolvedType($type)->getOptionsResolver()->resolve($type->getOptions());
    }
132657
public function setDefaultOptions(OptionsResolver $resolver)
    {
        foreach ($this->middlewares as $middleware) {
            if ($middleware instanceof ConfigurableInterface) {
                $middleware->setDefaultOptions($resolver);
            }
        }
    }
247937
protected function resolvePageOptions(array $options = array())
    {
        $resolver = new OptionsResolver;
        $this->setDefaultPageOptions($resolver);

        if (!empty($this->pageOptions)) {
            $resolver->setDefaults($this->pageOptions);
        }

        return $resolver->resolve($options);
    }
1292927
public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $defaultConfigs = array(
            'datagrid_exists' => $this->datagridExists,   
        );
        
        $resolver->setDefaults(array(
            'allow_add' => true,
            'allow_delete' => true,
            'prototype' => true,
            'by_reference' => false,
            'type' => 'thrace_multi_select',
            'translation_domain' => 'ThraceFormBundle',
            'configs' => $defaultConfigs,
        ));
        
        $resolver->setNormalizers(array(            
            'configs' => function (Options $options, $value) use ($defaultConfigs){
                $configs = array_replace_recursive($defaultConfigs, $value);
                return $configs;
            }
        ));
          
        $resolver->setRequired(array('grid'));
        
        $resolver->setAllowedTypes(array(
            'grid' => array('object'),
        ));
    }
232233
protected function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setRequired(
            [
                'family',
            ]
        );
        /** @noinspection PhpUnusedParameterInspection */
        $resolver->setNormalizer(
            'family',
            function (Options $options, $value) {
                if ($value instanceof FamilyInterface) {
                    return $value;
                }

                return $this->familyRegistry->getFamily($value);
            }
        );
        $resolver->setAllowedTypes('family', ['string', FamilyInterface::class]);
    }
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);
    }
301549
private function resolveOptions(array $options = [])
    {
        $resolver = new OptionsResolver();
        $this->configure($resolver);

        return $resolver->resolve($options);
    }
793420
public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        
        $defaultConfigs = array(
            'showOn' => 'button',
            'buttonImageOnly' => true,
        );
        
        $resolver->setDefaults(array(
            'input' => 'datetime',
            'format' => 'Y-m-d',
            'date_timezone' => null,
            'user_timezone' => null,
            'translation_domain' => 'ThraceFormBundle',
            'configs' => $defaultConfigs,
    
        ));
        
        $resolver->setNormalizers(array(
            'format' => function (Options $options, $value) {
                return 'Y-m-d';
            },
            'configs' => function (Options $options, $value) use ($defaultConfigs) {
                $configs = array_replace_recursive($defaultConfigs, $value);
                
                $configs['dateFormat'] = 'yy-mm-dd';
                
                return $configs;
            }
        ));

        $resolver->setAllowedValues(array(
            'input' => array(
                'datetime',
                'string',
                'timestamp',
                'array',
            )   
        ));
    }
284360
public function configureOptions(OptionsResolver $resolver)
    {
        $resolver
            ->setDefaults([
                'type' => TextType::class,
                'options' => [],
                'comparator' => 'like',
                'operator' => 'or',
            ])
            ->setRequired('name')
            ->setAllowedTypes('name', 'string')
            ->setAllowedTypes('type', 'string')
            ->setAllowedTypes('options', 'array')
            ->setAllowedTypes('comparator', 'string')
            ->setAllowedTypes('operator', 'string')
            ->setAllowedValues('operator', [
                'and',
                'or',
            ])
        ;
    }