作者:ashutosh-srija
项目:findit_akene
/**
* @return OptionsResolverInterface
*/
protected function createOptionsResolver()
{
$resolver = new OptionsResolver();
$resolver->setOptional(['flush', 'copy_values_to_products', 'add_products', 'remove_products']);
$resolver->setAllowedTypes(['flush' => 'bool', 'copy_values_to_products' => 'bool', 'add_products' => 'array', 'remove_products' => 'array']);
return $resolver;
}
作者:Dren-
项目:mobi
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
/* Note: the form's intention must correspond to that for the form login
* listener in order for the CSRF token to validate successfully.
*/
$resolver->setDefaults(array('intention' => 'authenticate'));
}
作者:php-cach
项目:adapter-bundl
/**
* {@inheritdoc}
*/
protected static function configureOptionResolver(OptionsResolver $resolver)
{
$resolver->setDefaults(['host' => '127.0.0.1', 'port' => 11211, 'redundant_servers' => []]);
$resolver->setAllowedTypes('host', ['string']);
$resolver->setAllowedTypes('port', ['string', 'int']);
$resolver->setAllowedTypes('redundant_servers', ['array']);
}
作者:ahmadrabi
项目:Syliu
function it_should_define_assigned_data_class(OptionsResolver $resolver)
{
$resolver->setDefaults(['data_class' => 'Rule', 'validation_groups' => ['Default']])->shouldBeCalled();
$resolver->setDefined(['configuration_type'])->shouldBeCalled();
$resolver->setDefaults(['configuration_type' => RuleInterface::TYPE_ITEM_TOTAL])->shouldBeCalled();
$this->configureOptions($resolver);
}
作者:behinddesig
项目:swarro
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolver $resolver)
{
$resolver->setRequired(['new_relic_app_name']);
$resolver->setDefaults(['new_relic_license' => null, 'new_relic_transaction_name' => function (Options $options) {
return sprintf('swarrot %s', $options['queue']);
}]);
}
作者:BusinessCookie
项目:CoffeeMachineProjec
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array('type' => 'text', 'options' => array(), 'first_options' => array(), 'second_options' => array(), 'first_name' => 'first', 'second_name' => 'second', 'error_bubbling' => false));
$resolver->setAllowedTypes('options', 'array');
$resolver->setAllowedTypes('first_options', 'array');
$resolver->setAllowedTypes('second_options', 'array');
}
作者:klink
项目:time
/**
* @param OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
$user = $this->tokenStorage->getToken()->getUser();
$resolver->setDefaults(array('data_class' => Task::class, 'empty_data' => function (FormInterface $form) use($user) {
return new Task($form->getData()['name'], $user);
}));
}
作者:heartshar
项目:FOSHttpCach
/**
* When creating this subscriber, you can configure a number of options.
*
* - refresh_client_matcher: RequestMatcher to identify valid refresh clients.
* - refresh_client_ips: IP or array of IPs that are allowed to refresh.
*
* Only set one of refresh_client_ips and refresh_client_matcher.
*
* @param array $options Options to overwrite the default options
*
* @throws \InvalidArgumentException if unknown keys are found in $options
*/
public function __construct(array $options = [])
{
$resolver = new OptionsResolver();
$resolver->setDefaults(['refresh_client_matcher' => null, 'refresh_client_ips' => null]);
$options = $resolver->resolve($options);
parent::__construct($options['refresh_client_matcher'], $options['refresh_client_ips']);
}
作者:ls
项目:altapay-php-ap
/**
* Resolve amount option
*
* @param OptionsResolver $resolver
*/
protected function setCurrencyResolver(OptionsResolver $resolver)
{
$resolver->setAllowedTypes('currency', ['string', 'int']);
$resolver->setAllowedValues('currency', function ($value) {
return CurrencyTypes::currencyCodeExists($value) || CurrencyTypes::currencyNumberExists($value);
});
}
作者:rollerwork
项目:datagri
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(['value_glue' => null, 'value_format' => null, 'empty_value' => null]);
$resolver->setAllowedTypes('value_glue', ['string', 'null']);
$resolver->setAllowedTypes('value_format', ['string', 'callable', 'null']);
$resolver->setAllowedTypes('empty_value', ['string', 'array', 'null']);
}
作者:morion
项目:payment-gatewa
/**
* @param array $options
*/
public function __construct(array $options)
{
$resolver = new OptionsResolver();
$resolver->setRequired(['secret', 'currency', 'min_sum'])->setDefaults(['math' => new NativeMath(), 'currency' => 'usd', 'min_sum' => 0])->setAllowedTypes('math', MathInterface::class);
$options = $resolver->resolve($options);
$this->options = $options;
}
作者:snikolo
项目:silex-issue-tracke
/**
*
* @param array $options
* @return array
*/
public function configureOptions(array $options = array())
{
$resolver = new OptionsResolver();
$resolver->setDefaults(array('adapter' => 'default', 'host' => $this->getHost(), 'username' => null, 'password' => null, 'port' => $this->getPort(), 'auth_mode' => $this->getAuthMode(), 'encryption' => $this->getEncryption()));
$this->options = $resolver->resolve($options);
return $this->options;
}
作者:EHLOVade
项目:CodeQualityThreshol
/**
* Resolves options
*
* @param array $options
* @return array
*/
protected function resolveConfigurationOptions(array $configurationOptions)
{
$optionsResolver = new OptionsResolver();
$optionsResolver->setDefaults($this->defaultOptions);
$optionsResolver->setRequired(array_keys($this->defaultOptions));
return $optionsResolver->resolve($configurationOptions);
}
作者:Kyra277
项目:AM
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$entryOptionsNormalizer = function (Options $options, $value) {
$value['block_name'] = 'entry';
return $value;
};
$optionsNormalizer = function (Options $options, $value) use($entryOptionsNormalizer) {
if (null !== $value) {
@trigger_error('The form option "options" is deprecated since version 2.8 and will be removed in 3.0. Use "entry_options" instead.', E_USER_DEPRECATED);
}
return $entryOptionsNormalizer($options, $value);
};
$typeNormalizer = function (Options $options, $value) {
if (null !== $value) {
@trigger_error('The form option "type" is deprecated since version 2.8 and will be removed in 3.0. Use "entry_type" instead.', E_USER_DEPRECATED);
}
return $value;
};
$entryType = function (Options $options) {
if (null !== $options['type']) {
return $options['type'];
}
return __NAMESPACE__ . '\\TextType';
};
$entryOptions = function (Options $options) {
if (1 === count($options['options']) && isset($options['block_name'])) {
return array();
}
return $options['options'];
};
$resolver->setDefaults(array('allow_add' => false, 'allow_delete' => false, 'prototype' => true, 'prototype_data' => null, 'prototype_name' => '__name__', 'type' => null, 'options' => null, 'entry_type' => $entryType, 'entry_options' => $entryOptions, 'delete_empty' => false));
$resolver->setNormalizer('type', $typeNormalizer);
$resolver->setNormalizer('options', $optionsNormalizer);
$resolver->setNormalizer('entry_options', $entryOptionsNormalizer);
}
作者:kret
项目:kret
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setRequired(['roles']);
$resolver->setDefaults(['csrf_protection' => false, 'data_class' => InviteUserCommand::class, 'empty_data' => function (FormInterface $form) {
return new InviteUserCommand($form->get('email')->getData(), $this->roles);
}]);
}
作者:phpr
项目:grumph
/**
* @return OptionsResolver
*/
public function getConfigurableOptions()
{
$resolver = new OptionsResolver();
$resolver->setDefaults(['ignore_patterns' => []]);
$resolver->addAllowedTypes('ignore_patterns', ['array']);
return $resolver;
}
作者:Drake86cn
项目:yacar
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array('choices' => array('Sin confirmar' => 0, 'Confirmado' => 10, 'Cotejado' => 20, 'Certificado' => 30), 'label' => 'Nivel de confirmación', 'attr' => array('help' => '<a href="#" class="text-warning" data-toggle="collapse"
data-target="#VerificacionNivelType_MasInfo"><i class="fa fa-info-circle">
</i> Más información sobre los niveles de confirmación</a>
<div id="VerificacionNivelType_MasInfo" class="collapse">
<small><dl class="dl-horizontal">
<dt>Sin confirmar</dt>
<dd>Datos proporcionados por la persona, por lo general de forma verbal, sobre los cuales
no se tiene ninguna confirmación ni se cotejaron con alguna documentación.</dd>
<dt>Confirmado</dt>
<dd>Datos sobre los cuales se tiene alguna confirmación aunque sea informal. Por ejemplo: un número
telefónico con el cual Usted se pudo comunicar al menos una vez.</dd>
<dt>Cotejado</dt>
<dd>Datos cotejados con alguna documentación pertinente, por ejemplo: la persona mostró su DNI
o dejó una copia para poder cotejar el domicilio.</dd>
<dt>Certificado</dt>
<dd>Datos avalados por alguna prueba y sobre los cuales se conserva algún registro (original,
fotocopia legalizada, fotocopia certificada, etc.).</dd>
</dl></small>
</div>')));
}
作者:open-orchestr
项目:open-orchestra-model-bundl
/**
* @param OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
$multiLanguagesChoiceManager = $this->multiLanguagesChoiceManager;
$resolver->setDefaults(array('embedded' => true, 'class' => $this->statusClass, 'choice_label' => function (StatusInterface $choice) use($multiLanguagesChoiceManager) {
return $multiLanguagesChoiceManager->choose($choice->getLabels());
}));
}
作者:ahmadrabi
项目:Syliu
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$choiceList = function (Options $options) {
return new VariantChoiceList($options['variable']);
};
$resolver->setDefaults(['multiple' => false, 'expanded' => true, 'choice_list' => $choiceList])->setRequired(['variable'])->setAllowedTypes('variable', VariableInterface::class);
}
作者:symfon
项目:symfon
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
// Make sure that validation groups end up as null, closure or array
$validationGroupsNormalizer = function (Options $options, $groups) {
if (false === $groups) {
return array();
}
if (empty($groups)) {
return;
}
if (is_callable($groups)) {
return $groups;
}
if ($groups instanceof GroupSequence) {
return $groups;
}
return (array) $groups;
};
$resolver->setDefaults(array(
'validation_groups' => null,
));
$resolver->setNormalizer('validation_groups', $validationGroupsNormalizer);
}